【发布时间】:2017-08-22 17:48:00
【问题描述】:
我正在寻找一种使用 SplitView 和其他 XAML 控件创建导航窗格的方法。
我尝试过创建类似于下面代码的内容,但我失败了,因为控件没有精确地放置在中心(垂直)。
这些按钮还有这种奇怪的默认动画,当它们被点击时会倾斜。我想关掉它,但我不知道怎么做。
总而言之,我想创建一个类似于 Windows 10 周年更新中的开始菜单的汉堡菜单。非常感谢所有意见。
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<SplitView x:Name="hamburgerMenu" HorizontalAlignment="Left" Width="319" DisplayMode="CompactOverlay">
<SplitView.Pane>
<StackPanel>
<Button x:Name="HamburgerButton" Width="320" Height="48" Click="HamburgerButtonClick" BorderThickness="0" Background="{x:Null}" HorizontalContentAlignment="Left">
<StackPanel Orientation="Horizontal" Margin="-8,0,0,0">
<TextBlock Width="48" FontFamily="Segoe MDL2 Assets" Text="" TextAlignment="Center" Margin="0,1,0,0" />
<TextBlock Text="MENU" Margin="0,0,0,0" FontWeight="Bold" />
</StackPanel>
</Button>
<Button x:Name="TasksButton" Width="320" Height="48" BorderThickness="0" Background="{x:Null}" HorizontalContentAlignment="Left">
<StackPanel Orientation="Horizontal" Margin="-8,0,0,0">
<TextBlock Width="48" FontFamily="Segoe MDL2 Assets" Text="" TextAlignment="Center" VerticalAlignment="Center" />
<TextBlock Text="Tasks" Margin="0,0,0,0"/>
</StackPanel>
</Button>
<Button x:Name="ArchivedButton" Width="320" Height="48" BorderThickness="0" Background="{x:Null}" HorizontalContentAlignment="Left">
<StackPanel Orientation="Horizontal" Margin="-8,0,0,0">
<TextBlock Width="48" FontFamily="Segoe MDL2 Assets" Text="" TextAlignment="Center" VerticalAlignment="Center" />
<TextBlock Text="Archived" Margin="0,0,0,0"/>
</StackPanel>
</Button>
</StackPanel>
</SplitView.Pane>
</SplitView>
</Grid>
这是我想要实现的目标:
【问题讨论】:
-
您可能想针对应用顶部的白条创建一个新问题,因为这可能是一个单独的问题。我还将发布代码当前生成的屏幕截图
-
我已经编辑了帖子。屏幕截图在底部。
标签: c# xaml uwp hamburger-menu