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>
查看全文
相关阅读:
在win2003中sql server2005的安装及配置
excel多行以逗号拼接为一行
git删除分支
IeXglEvEyH
excel为某列数据加双引号和逗号,用于拼接成json列表
where 1=1 的作用
ThreadLocal 定义、使用场景、案例、原理、注意事项
gitlab第一次开发项目步骤
git切回旧版本代码后再切回最新代码
CountDownLatch与CyclicBarrier与Semaphore的区别
原文地址:https://www.cnblogs.com/javawebsoa/p/2457973.html
最新文章
渗透方向学习路线
意外
信息安全第十五讲--物联网安全技术作业
信息安全第十四讲--物联网安全架构与基础设施作业
VMware中安装了Linux没有IP地址,或者显示127.0.0.1
Linux中修改源镜像地址 | 解决软件无法更新以及下载太慢问题
信息安全第十二讲--信息安全管理技术作业
信息安全第十一讲--信息安全测评技术作业
信息安全第十讲--内容安全技术作业
信息安全第九讲--恶意代码检测与防范技术作业
热门文章
信息安全第八讲--安全审计与责任认定作业
nvcatmysql安装以及远程连接MySQL
基于win2003安装MySQL
sqli-lab环境搭建
apache、nginx、iis的日志内容
反向代理
负载均衡
C段入侵
4.14课后作业-旁注
云服务器ECS建站---操作系统为CentOS 7
Copyright © 2011-2022 走看看