将下拉菜单添加到汉堡菜单C#UAP

时间:2017-03-30 09:06:53

标签: c# windows xaml uap

我想在此汉堡菜单中添加一个下拉菜单 所以首先你打开汉堡菜单,当你点击设置时,它会打开另一个包含项目的下拉菜单。

Xaml和C#:

  <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="&#xE10F;"
                Width="50" Height="50" Background="Transparent" Click="MenuButton1_Click"/>
                    <TextBlock Text="Sales" FontSize="18" VerticalAlignment="Center" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Button x:Name="MenuButton2" FontFamily="Segoe MDL2 Assets" Content="&#xE825;"
                    Width="50" Height="50" Background="Transparent"/>
                    <TextBlock Text="Marketing" FontSize="18" VerticalAlignment="Center" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Button x:Name="MenuButton3" FontFamily="Segoe MDL2 Assets" Content="&#xE115;"
                    Width="50" Height="50" Background="Transparent"/>
                    <TextBlock Text="Settings" FontSize="18" VerticalAlignment="Center" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Button x:Name="MenuButton4" FontFamily="Segoe MDL2 Assets" Content="&#xE134;"
                    Width="50" Height="50" Background="Transparent"/>
                    <TextBlock Text="Help" FontSize="18" VerticalAlignment="Center" />
                </StackPanel>
            </StackPanel>
        </SplitView.Pane>
        <SplitView.Content>
            <Grid>
                <TextBlock Text="SplitView Basic" FontSize="54" Foreground="White"
                       HorizontalAlignment="Center" VerticalAlignment="Center"/>
            </Grid>
        </SplitView.Content>
    </SplitView>
</Grid>

    private void HamburgerButton_Click(object sender, RoutedEventArgs e)
    {
        MySplitView.IsPaneOpen = !MySplitView.IsPaneOpen;
    }

    private void MenuButton1_Click(object sender, RoutedEventArgs e)
    {

    }

0 个答案:

没有答案