1.Expander 控件介绍

折叠控件 GroupBox 带标题 HeaderedContentControl

折叠或展开的特点,IsExpand 是否显示内容,默认False (隐藏的) ExpandDirection 展开方向 Down Up left right

GroupBox 不能折叠内容部分,Expander可折叠,节省区域
多内容显示—布局控件

Expanded    Collapsed  事件

2.具体案例

<Window x:Class="WpfAppTest.ExpanderWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfAppTest"
        mc:Ignorable="d"
        Title="ExpanderWindow" Height="450" Width="800">
        <Grid>
                <Expander Header="用户权限" HorizontalAlignment="Left" Height="auto" Margin="146,121,0,0" VerticalAlignment="Top" Width="200" Padding="10" ExpandDirection="Down" BorderThickness="2" BorderBrush="Green" IsExpanded="False">
                        <StackPanel Background="#FFE5E5E5">
                                <CheckBox Content="管理员"/>
                                <CheckBox Content="系统管理员"/>
                                <CheckBox Content="业务员"/>
                        </StackPanel>
                </Expander>


        </Grid>
</Window>