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>
查看全文
相关阅读:
Winform中实现FTP客户端并定时扫描指定路径下文件上传到FTP服务端然后删除文件
NodeRED简介与Windows上安装、启动和运行示例
CentOS7中后台运行NodeRED(关闭窗口也能访问服务)
CentOS7中使用PM2设置NodeRED开机自启动
Windows上编译github源码方式运行NodeRED,以及离线迁移安装NodeRED
升级npm
FastAPI 学习之路(十八)表单与文件
FastAPI 学习之路(十七)上传文件
ArcGIS9.2新功能之File Geodatabase(对比PGDB) 【转】
Catalog无法连接Server
原文地址:https://www.cnblogs.com/javawebsoa/p/2457973.html
最新文章
做了一个简易winform拓扑图控件
提醒小工具:GuYuTodo
python初体验
WPF、Windows Forms和Silverlight间的联系和区别
Python PIL Image模块中有Open方法却没有Close方法!?
想当年,还会用C语言打印日历呢
个人笔记、建站利器:PmWiki
K8s 中什么是静态 pod (static pod)
Ubuntu18.04 虚拟机使用 NAT 模式设置静态 IP 并可以成功访问互联网(VMWare下)
docker中宿主机与容器(container)互相拷贝传递文件的方法
热门文章
GoLand 自动生成单元测试代码框架
ubuntu 系统中 Goland 报错 External file changes sync may be slow: The current inotify(7) watch limit is too low
Linux 下配置代理
使用 Kind 创建1.20.7 版本的 K8s 一主二从集群
K8s node 断开连接后,在该 node 中运行的 Pod 会如何?
CentOS7中通过二进制文件与配置环境变量的方式安装Node
CentOS7中通过npm的方式安装NodeRED
JS中生成8位的随机数字
Vue项目借助浏览调整适配显示器的分辨率
Winform中使用FileStream读取文件后,继续操作提示:it is being used by anothor process
Copyright © 2011-2022 走看看