2021-08-19 WPF控件专题 Expander 控件详解

男娘i 2022-09-06 00:09 544阅读 0赞

在这里插入图片描述

1.Expander 控件介绍

折叠控件 GroupBox 带标题 HeaderedContentControl

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

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

  1. Expanded Collapsed 事件

2.具体案例

  1. <Window x:Class="WpfAppTest.ExpanderWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:WpfAppTest"
  7. mc:Ignorable="d"
  8. Title="ExpanderWindow" Height="450" Width="800">
  9. <Grid>
  10. <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">
  11. <StackPanel Background="#FFE5E5E5">
  12. <CheckBox Content="管理员"/>
  13. <CheckBox Content="系统管理员"/>
  14. <CheckBox Content="业务员"/>
  15. </StackPanel>
  16. </Expander>
  17. </Grid>
  18. </Window>

发表评论

表情:
评论列表 (有 0 条评论,544人围观)

还没有评论,来说两句吧...

相关阅读