How to remove the default shadow behind the Content Dialog in uwp

Md. Niaz Mahmud 171 Reputation points

How to remove the default shadow that is content dialog in uwp???

Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,861 Reputation points

    Hello @Md. Niaz Mahmud Welcome to Microsoft Q&A,

    How to remove shadow of ContentDialog in UWP?

    Please check Z-depth and shadow document.

    ThemeShadow automatically casts shadows when applied to any XAML element in a Popup. It will cast shadows on the app background content behind it and any other open Popups below it.

    If you want to disable it, the better way is that set Container a new Translation in loaded event, and make z value as low enough.

    For example: (place the style of ContentDialog in the page resource and give it new Key MyContentDialog ).

    var diaog = new ContentDialog() { Title = "hello world!",Style= (Style)Resources["MyContentDialog"] ,SecondaryButtonText="ok"};    
    await diaog.ShowAsync();  

    Set the new Translation.

    private void Container_Loaded(object sender, RoutedEventArgs e)  
      var border = sender as Border;  
      border.Translation += new Vector3(0, 0, -100);  

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments