[UWP] navigationview - NavigationView.PaneFooter中的username-property [英] [UWP] navigationview - username-property in NavigationView.PaneFooter
问题描述
您好!
在文章 https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/navigationview
In the article https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/navigationview
段落"窗格页脚",您可以在屏幕截图中看到项目"用户名"。但我无法弄清楚如何重新创建它。
paragraph "Pane Footer", you see in the Screenshot the item "User Name". But I can't figure out how to recreate it.
感谢您的帮助!
推荐答案
您好,
如果您不知道如何自定义新项目。您只需添加如下所示的PaneFooter:
If you don't konw how to customize a new item. Simply you can add a PaneFooter like the following:
<NavigationView.PaneFooter>
<NavigationViewItem>
<NavigationViewItem.Icon>
<SymbolIcon Symbol="Contact"/>
</NavigationViewItem.Icon>
<NavigationViewItem.Content>
<ContentPresenter Content="User"/>
</NavigationViewItem.Content>
</NavigationViewItem>
</NavigationView.PaneFooter>
但这会将项目置于设定项目之上。
But that would put an item above the setting item.
如果您需要与您显示的文档完全相同,您需要右键单击xaml中的导航视图,然后创建模板的副本。然后添加以下内容:
If you need exactly the same like the doc you shows, you need to right click your navigationview from xaml, then create a copy of the template. Then add the following:
1。找到PaneContentGrid并添加一行:
1. Find PaneContentGrid and add a line:
<Grid x:Name="PaneContentGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0"/>
<RowDefinition x:Name="PaneContentGridToggleButtonRow" Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="8"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="8"/>
</Grid.RowDefinitions>
2。在NavigationPane结束时,添加以下内容:
2. At the end of NavigationPane, add the following:
<NavigationViewItem x:Name="test" Grid.Row="8">
<NavigationViewItem.Icon>
<SymbolIcon Symbol="Contact"/>
</NavigationViewItem.Icon>
<NavigationViewItem.Content>
<ContentPresenter Content="User"/>
</NavigationViewItem.Content>
</NavigationViewItem>
</Grid>
祝你好运,
Barry
这篇关于[UWP] navigationview - NavigationView.PaneFooter中的username-property的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!