diff --git a/dev/NavigationView/NavigationView.cpp b/dev/NavigationView/NavigationView.cpp index 4af65e6362..2a8f928a3f 100644 --- a/dev/NavigationView/NavigationView.cpp +++ b/dev/NavigationView/NavigationView.cpp @@ -3594,6 +3594,12 @@ void NavigationView::UpdatePaneShadow() if (auto contentGrid = GetTemplateChildT(c_contentGridName, *this)) { contentGrid.SetRowSpan(shadowReceiver, contentGrid.RowDefinitions().Size()); + contentGrid.SetRow(shadowReceiver, 0); + // Only register to columns if those are actually defined + if (contentGrid.ColumnDefinitions().Size() > 0) { + contentGrid.SetColumn(shadowReceiver, 0); + contentGrid.SetColumnSpan(shadowReceiver, contentGrid.ColumnDefinitions().Size()); + } contentGrid.Children().Append(shadowReceiver); winrt::ThemeShadow shadow; @@ -3611,9 +3617,16 @@ void NavigationView::UpdatePaneShadow() } } + // Shadow will get clipped if casting on the splitView.Content directly // Creating a canvas with negative margins as receiver to allow shadow to be drawn outside the content grid - winrt::Thickness shadowReceiverMargin = { -CompactPaneLength(), -c_paneElevationTranslationZ, -c_paneElevationTranslationZ, -c_paneElevationTranslationZ }; + winrt::Thickness shadowReceiverMargin = { 0, -c_paneElevationTranslationZ, -c_paneElevationTranslationZ, -c_paneElevationTranslationZ }; + + // Ensuring shadow is aligned to the left + shadowReceiver.HorizontalAlignment(winrt::HorizontalAlignment::Left); + + // Ensure shadow is as wide as the pane when it is open + shadowReceiver.Width(OpenPaneLength()); shadowReceiver.Margin(shadowReceiverMargin); } } diff --git a/test/MUXControlsTestApp/master/NavigationView-8.xml b/test/MUXControlsTestApp/master/NavigationView-8.xml index 9f50776ca5..045a874b11 100644 --- a/test/MUXControlsTestApp/master/NavigationView-8.xml +++ b/test/MUXControlsTestApp/master/NavigationView-8.xml @@ -2124,14 +2124,15 @@ RenderSize=120,19 [Windows.UI.Xaml.Controls.Canvas] Background=[NULL] + Width=120 Name=PaneShadowReceiver - Margin=-40,-32,-32,-32 + Margin=0,-32,-32,-32 FocusVisualSecondaryThickness=1,1,1,1 FocusVisualSecondaryBrush=#99FFFFFF FocusVisualPrimaryThickness=2,2,2,2 FocusVisualPrimaryBrush=#FF000000 Visibility=Visible - RenderSize=72,664 + RenderSize=120,664 [Windows.UI.Xaml.Shapes.Rectangle] StrokeThickness=1 Name=LightDismissLayer