zoukankan
html css js c++ java
继续聊WPF——Expander控件(1)
欢迎加入.NET技术交流群:189931386
Expander是一个可以展开和折叠的控件,它包含两部分——标头和内容。
标头通Header属性来设置,内容通过Conent属性设置,如下面一个简单的例子:
<Expander ExpandDirection="Down" Width="96"> <Expander.Header> <TextBlock Text="标题" FontWeight="Bold"/> </Expander.Header> <Expander.Content> <TextBlock TextWrapping="Wrap" Text="这里是内容。"/> </Expander.Content> </Expander>
Expander控件的Header和Content都可以为任何对象,只要能正常显示即可。
下面就是该控件运行时的截图。
这个控件最实用的地方,就是做导航栏。
<StackPanel Margin="20,20" Width="100" Height="460" HorizontalAlignment="Left" VerticalAlignment="Top"> <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True"> <Expander.Header> <TextBlock Text="用户管理" FontSize="14" FontWeight="Bold" /> </Expander.Header> <Expander.Content> <Grid> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> </Grid.RowDefinitions> <RadioButton Grid.Row="0">会员管理</RadioButton> <RadioButton Grid.Row="1">角色管理</RadioButton> </Grid> </Expander.Content> </Expander> <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True"> <Expander.Header> <TextBlock Text="文档管理" FontSize="14" FontWeight="Bold" /> </Expander.Header> <Expander.Content> <Grid> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> </Grid.RowDefinitions> <RadioButton Grid.Row="0">部门资料</RadioButton> <RadioButton Grid.Row="1">员工资料</RadioButton> <RadioButton Grid.Row="2">职位资料</RadioButton> </Grid> </Expander.Content> </Expander> <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True"> <Expander.Header> <TextBlock Text="采购管理" FontSize="14" FontWeight="Bold" /> </Expander.Header> <Expander.Content> <Grid> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> </Grid.RowDefinitions> <RadioButton Grid.Row="0">采购计划</RadioButton> <RadioButton Grid.Row="1">需求分析</RadioButton> <RadioButton Grid.Row="2">采购单</RadioButton> <RadioButton Grid.Row="3">入库验收</RadioButton> <RadioButton Grid.Row="4">入库退回</RadioButton> </Grid> </Expander.Content> </Expander> <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True"> <Expander.Header> <TextBlock Text="供应商" FontSize="14" FontWeight="Bold" /> </Expander.Header> <Expander.Content> <Grid> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> </Grid.RowDefinitions> <RadioButton Grid.Row="0">基本资料</RadioButton> <RadioButton Grid.Row="1">往来单位</RadioButton> <RadioButton Grid.Row="2">上游供应商</RadioButton> </Grid> </Expander.Content> </Expander> </StackPanel>
另外,通过ExpandDirection属性可控其展开的方向。
<Expander VerticalAlignment="Stretch" ExpandDirection="Right" HorizontalContentAlignment="Left" SnapsToDevicePixels="True"> ............ </Expander>
查看全文
相关阅读:
使用Xcode 制作自定义storyboard启动界面,供uniAPP使用。
由于ios由UIWebView换成了WKWebview内核后导致webview请求接口文件上传,后台接收不到文件
标准基座获取定位可以获取address城市,自定义基座获取不到address
WeeklyEnglish 2020
Maven编译打包时报“PKIX path building failed”异常解决方法
Spring Security
在IDEA中导入GIT项目
利用git上传本地文件、文件夹到Github
OpenAM
CentOS 安装 OpenAM
原文地址:https://www.cnblogs.com/javawebsoa/p/2457973.html
最新文章
Spark源码剖析(四):Master原理与源码剖析(上)
Spark源码剖析(三):SparkContext原理与源码剖析
Spark源码剖析(二):Spark内核架构深度剖析
KafkaConsumer实现精确一次消费
Mysql加锁过程详解(6)-初步理解MySQL的gap锁
Mysql加锁过程详解(5)-数据库隔离级别
Mysql加锁过程详解(4)-innodb 多版本并发控制原理详解
Mysql加锁过程详解(3)-select for update/lock in share mode 对事务并发性影响
Mysql加锁过程详解(2)-关于mysql 幻读理解
Mysql加锁过程详解(1)-基本知识
热门文章
Kafka:Consumer
Kafka:Producer
Kafka的消息处理语义
可封装的方法
uniapp中使用animate.css4.1.1动画库在小程序中不生效解决办法
vue路由history模式刷新404问题解决方案
vue递归过滤树结构数组
vue安装使用v-chart时报错解决方案
云开发常用的语句
uniCloud爬虫获取网页数据
Copyright © 2011-2022 走看看