我想知道是否可以创建展开/折叠侧边栏菜单。例如
如果你们有任何例子/关于从哪里开始的任何建议。谢谢你。
这应该让你开始。
XAML
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel x:Name="Menu" Width="100" Background="LightBlue">
<TextBlock>Menu 1</TextBlock>
<TextBlock>Menu 2</TextBlock>
<TextBlock>Menu 3</TextBlock>
</StackPanel>
<Grid Grid.Column="1" Background="LightGray">
<Button Content="Expand/Collapse" Click="ButtonClick" />
</Grid>
</Grid>
C#
private void ButtonClick(object sender, RoutedEventArgs e)
{
this.Menu.Visibility = this.Menu.Visibility == Visibility.Visible
? Visibility.Collapsed
: Visibility.Visible;
}