admin管理员组文章数量:1301491
I'm trying to move the hamburger menu button from NavigationView into the title bar, similar to how the back button is placed. This behavior can be seen in the Community Toolkit Gallery
I know that custom title bar support was ported to the Windows App SDK in version 1.6, but it doesn't seem to work the same way as before. I haven't found any documentation on how to achieve this.
How can I place the pane button inside the title bar using the Windows App SDK?
I'm trying to move the hamburger menu button from NavigationView into the title bar, similar to how the back button is placed. This behavior can be seen in the Community Toolkit Gallery
I know that custom title bar support was ported to the Windows App SDK in version 1.6, but it doesn't seem to work the same way as before. I haven't found any documentation on how to achieve this.
How can I place the pane button inside the title bar using the Windows App SDK?
Share edited Feb 11 at 4:35 Kauã Ferreira Leal dos Santos asked Feb 11 at 4:35 Kauã Ferreira Leal dos SantosKauã Ferreira Leal dos Santos 113 bronze badges1 Answer
Reset to default 0You need to create a custom title bar.
Set the ExtendsContentIntoTitleBar
property to true
. And then call SetTitleBar
to switch to a new title bar element.
public MainWindow()
{
this.InitializeComponent();
ExtendsContentIntoTitleBar = true;
SetTitleBar(TitleBar);
}
You could add the button to the title bar in the xaml.
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid x:Name="TitleBar" >
<Button x:Name="HamburgerButton" Content="☰" Click="HamburgerButton_Click" />
</Grid>
<NavigationView x:Name="NavigationViewControl" Grid.Row="1" IsBackButtonVisible="Collapsed" IsPaneToggleButtonVisible="False">
</NavigationView>
</Grid>
.cs file:
private void HamburgerButton_Click(object sender, RoutedEventArgs e)
{
NavigationViewControl.IsPaneOpen = !NavigationViewControl.IsPaneOpen;
}
本文标签: winui 3hamburger menu button inside TitlebarStack Overflow
版权声明:本文标题:winui 3 - hamburger menu button inside Titlebar - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741678469a2392025.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论