SplitView 窗格中的分隔符
Separator in a SplitView Pane
我已经创建了一个 SplitView,但是我在为 SplitView 窗格中的菜单选项定义分隔符时遇到了问题,就像在 Groove Musique 应用程序中这样:
我尝试使用线形,但我认为这不是解决方案。
如何在我的 SplitView 窗格中定义这种分隔符?
以 Windows 10 SplitView – Build Your First Hamburger Menu 为指导,我使用 Border 和 Rectangle 对其进行了调整,如下所示,以实现分隔符。
<SplitView x:Name="MySplitView" DisplayMode="CompactOverlay" IsPaneOpen="False"
CompactPaneLength="50" OpenPaneLength="150">
<SplitView.Pane>
<StackPanel Background="Gray">
<Button x:Name="HamburgerButton" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent" Click="HamburgerButton_Click"/>
<StackPanel Orientation="Horizontal">
<Button x:Name="MenuButton1" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent"/>
<TextBlock Text="Button 1" FontSize="18" VerticalAlignment="Center" />
</StackPanel>
<Border BorderBrush="Red" BorderThickness="1" Width="Auto" HorizontalAlignment="Stretch" Margin="4,0"/>
<StackPanel Orientation="Horizontal">
<Button x:Name="MenuButton2" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent"/>
<TextBlock Text="Button 2" FontSize="18" VerticalAlignment="Center" />
</StackPanel>
<Rectangle HorizontalAlignment="Stretch" Fill="Blue" Height="4" Margin="4,0"/>
<StackPanel Orientation="Horizontal">
<Button x:Name="MenuButton3" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent"/>
<TextBlock Text="Button 3" FontSize="18" VerticalAlignment="Center" />
</StackPanel>
</StackPanel>
</SplitView.Pane>
<SplitView.Content>
<StackPanel>
<TextBlock Text="Separator Hamburger Menu Test"/>
</StackPanel>
</SplitView.Content>
</SplitView>
我发现上面的示例有点过时了,还没有为现实世界做好准备。你可以试试我在这里显示的示例......
https://bernhardelbl.wordpress.com/2015/11/17/hamburger-menu-with-splitview-for-windows-10-apps/
我已经创建了一个 SplitView,但是我在为 SplitView 窗格中的菜单选项定义分隔符时遇到了问题,就像在 Groove Musique 应用程序中这样:
我尝试使用线形,但我认为这不是解决方案。
如何在我的 SplitView 窗格中定义这种分隔符?
以 Windows 10 SplitView – Build Your First Hamburger Menu 为指导,我使用 Border 和 Rectangle 对其进行了调整,如下所示,以实现分隔符。
<SplitView x:Name="MySplitView" DisplayMode="CompactOverlay" IsPaneOpen="False"
CompactPaneLength="50" OpenPaneLength="150">
<SplitView.Pane>
<StackPanel Background="Gray">
<Button x:Name="HamburgerButton" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent" Click="HamburgerButton_Click"/>
<StackPanel Orientation="Horizontal">
<Button x:Name="MenuButton1" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent"/>
<TextBlock Text="Button 1" FontSize="18" VerticalAlignment="Center" />
</StackPanel>
<Border BorderBrush="Red" BorderThickness="1" Width="Auto" HorizontalAlignment="Stretch" Margin="4,0"/>
<StackPanel Orientation="Horizontal">
<Button x:Name="MenuButton2" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent"/>
<TextBlock Text="Button 2" FontSize="18" VerticalAlignment="Center" />
</StackPanel>
<Rectangle HorizontalAlignment="Stretch" Fill="Blue" Height="4" Margin="4,0"/>
<StackPanel Orientation="Horizontal">
<Button x:Name="MenuButton3" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent"/>
<TextBlock Text="Button 3" FontSize="18" VerticalAlignment="Center" />
</StackPanel>
</StackPanel>
</SplitView.Pane>
<SplitView.Content>
<StackPanel>
<TextBlock Text="Separator Hamburger Menu Test"/>
</StackPanel>
</SplitView.Content>
</SplitView>
我发现上面的示例有点过时了,还没有为现实世界做好准备。你可以试试我在这里显示的示例...... https://bernhardelbl.wordpress.com/2015/11/17/hamburger-menu-with-splitview-for-windows-10-apps/