Search code examples
xamluwpwinui-3winuiwinui-xaml

Remove NavigationView gap in Content area (WinUI 3 version)


Anyone know how to reduce or remove this padding on the content area of NavigationView (WinUI 3)?? I'd like to do this without using a Style. Is there a resource I can override?

The reason I ask is because if you remove the Back button, the area is not correctly aligned when in narrow view.

enter image description here


Solution

  • Based on the solution provided by @Andrew-KeepCoding, the only change needed to achieve this was the name of the Key:

    <NavigationView Header="Sample Page" ...>
        <NavigationView.Resources>
            <Thickness x:Key="NavigationViewMinimalHeaderMargin">24,0,0,0</Thickness>
        </NavigationView.Resources>
    </NavigationView>