Skip to content

Commit

Permalink
Fix children flyout margin
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed Apr 27, 2020
1 parent 5845073 commit 97d804e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ModernWpf.Controls/NavigationView/NavigationView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@
<Style TargetType="local:FlyoutPresenter">
<Setter Property="Padding" Value="0,8" />
<!-- Set negative top margin to make the flyout align exactly with the button -->
<Setter Property="Margin" Value="0,-4,0,0" />
<!--<Setter Property="Margin" Value="0,-4,0,0" />-->
</Style>
</local:Flyout.FlyoutPresenterStyle>
<Grid x:Name="FlyoutRootGrid">
Expand Down
6 changes: 6 additions & 0 deletions ModernWpf.Controls/NavigationView/NavigationViewItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public partial class NavigationViewItem : NavigationViewItemBase
const string c_navigationViewItemPresenterName = "NavigationViewItemPresenter";
const string c_repeater = "NavigationViewItemMenuItemsHost";
const string c_rootGrid = "NVIRootGrid";
const string c_childrenFlyout = "ChildrenFlyout";
const string c_flyoutContentGrid = "FlyoutContentGrid";

// Visual States
Expand Down Expand Up @@ -128,6 +129,11 @@ public override void OnApplyTemplate()
UpdateRepeaterItemsSource();
}

if (GetTemplateChildT<FlyoutBase>(c_childrenFlyout, controlProtected) is { } childrenFlyout)
{
childrenFlyout.Offset = 0;
}

m_flyoutContentGrid = GetTemplateChildT<Grid>(c_flyoutContentGrid, controlProtected);

m_appliedTemplate = true;
Expand Down

0 comments on commit 97d804e

Please sign in to comment.