WinUI3 bits of .NET MAUI NavigationView extracted out to a WinUI 3 only project. .NET MAUI not required to run this project.
There doesn't appear to be many places where you can customize the size/margin of things on the NavigationView. So, I just wait for the source code to make a change that doesn't work for me and then I change it back
https://github.com/microsoft/microsoft-ui-xaml/blob/main/dev/NavigationView/NavigationView.cpp#L90-L96 https://github.com/microsoft/microsoft-ui-xaml/blob/main/dev/NavigationView/NavigationView.cpp#L4574
We'd like to just keep the NavigationView using as much of the default ControlTemplate as possible. When we update WinUI the NavigationView will just use the new ControlTemplate. We have tests in place to check that things all still measure/layout correctly if we need to adjust.
- Switch Implementation from
Window.SetTitleBar
toAppWindow
APIs so that we can do draggable areas and styling - Figure out a Windows 10 solution
Previously we were just using 48 for the app bar title height. This PR makes it so the NavigationView will auto resize/pad/margin based on the height of the app titlebar. You can also now replace the AppTitleBar by specifying your own DataTemplate
inside the WinUI
resource file.
All of the logic here has been extracted out to https://github.com/PureWeen/MauiNavigationView
To make playing around with this all easier
<Application.Resources>
<ResourceDictionary>
<DataTemplate x:Key="MauiAppTitleBarTemplate">
<TextBlock Height="300">RABBITS</TextBlock>
</DataTemplate>
</ResourceDictionary>
</Application.Resources>
<maui:MauiWinUIApplication.Resources>
<DataTemplate x:Key="MauiAppTitleBarContainerTemplate">
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="Click Me"></Button>
<Button Grid.Column="1" Content="Click Me"></Button>
<Button Grid.Column="2" Content="Click Me"></Button>
<Button Grid.Column="3" Content="Click Me"></Button>
<ContentControl
Grid.Column="4"
IsTabStop="False"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
x:Name="AppTitleBarContentControl">
</ContentControl>
</Grid>
</DataTemplate>
</maui:MauiWinUIApplication.Resources>