SplitView窗格中的分隔符

时间:2016-01-06 00:40:39

标签: win-universal-app windows-10-universal

我已经创建了一个SplitView,但是我在Groove Musique应用程序中为SplitView窗格中的菜单选项定义了一个分隔符时遇到了问题:

enter image description here

我尝试使用线形,但我认为这不是解决方案。

如何在SplitView窗格中定义这种分隔符?

2 个答案:

答案 0 :(得分:1)

使用example img作为指导,我使用边框和矩形对其进行了调整,如下图所示。

Windows 10 SplitView – Build Your First Hamburger Menu

<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="&#xE700;"
             Width="50" Height="50" Background="Transparent" Click="HamburgerButton_Click"/>
            <StackPanel Orientation="Horizontal">
                <Button x:Name="MenuButton1" FontFamily="Segoe MDL2 Assets" Content="&#xE825;"
             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="&#xE10F;"
                 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="&#xE1D6;"
                 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>

答案 1 :(得分:1)

我发现上面的示例有点过时,没有为现实世界做好准备。您可以尝试我在此处显示的示例... https://bernhardelbl.wordpress.com/2015/11/17/hamburger-menu-with-splitview-for-windows-10-apps/