这个控件最实用的地方,就是做导航栏。

  1. <StackPanel Margin="20,20" Width="100" Height="460" HorizontalAlignment="Left"
  2. VerticalAlignment="Top">
  3. <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True">
  4. <Expander.Header>
  5. <TextBlock Text="用户管理" FontSize="14" FontWeight="Bold" />
  6. </Expander.Header>
  7. <Expander.Content>
  8. <Grid>
  9. <Grid.RowDefinitions>
  10. <RowDefinition Height="auto"/>
  11. <RowDefinition Height="auto"/>
  12. </Grid.RowDefinitions>
  13. <RadioButton Grid.Row="0">会员管理</RadioButton>
  14. <RadioButton Grid.Row="1">角色管理</RadioButton>
  15. </Grid>
  16. </Expander.Content>
  17. </Expander>
  18. <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True">
  19. <Expander.Header>
  20. <TextBlock Text="文档管理" FontSize="14" FontWeight="Bold" />
  21. </Expander.Header>
  22. <Expander.Content>
  23. <Grid>
  24. <Grid.RowDefinitions>
  25. <RowDefinition Height="auto"/>
  26. <RowDefinition Height="auto"/>
  27. <RowDefinition Height="auto"/>
  28. </Grid.RowDefinitions>
  29. <RadioButton Grid.Row="0">部门资料</RadioButton>
  30. <RadioButton Grid.Row="1">员工资料</RadioButton>
  31. <RadioButton Grid.Row="2">职位资料</RadioButton>
  32. </Grid>
  33. </Expander.Content>
  34. </Expander>
  35. <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True">
  36. <Expander.Header>
  37. <TextBlock Text="采购管理" FontSize="14" FontWeight="Bold" />
  38. </Expander.Header>
  39. <Expander.Content>
  40. <Grid>
  41. <Grid.RowDefinitions>
  42. <RowDefinition Height="auto"/>
  43. <RowDefinition Height="auto"/>
  44. <RowDefinition Height="auto"/>
  45. <RowDefinition Height="auto"/>
  46. <RowDefinition Height="auto"/>
  47. </Grid.RowDefinitions>
  48. <RadioButton Grid.Row="0">采购计划</RadioButton>
  49. <RadioButton Grid.Row="1">需求分析</RadioButton>
  50. <RadioButton Grid.Row="2">采购单</RadioButton>
  51. <RadioButton Grid.Row="3">入库验收</RadioButton>
  52. <RadioButton Grid.Row="4">入库退回</RadioButton>
  53. </Grid>
  54. </Expander.Content>
  55. </Expander>
  56. <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True">
  57. <Expander.Header>
  58. <TextBlock Text="供应商" FontSize="14" FontWeight="Bold" />
  59. </Expander.Header>
  60. <Expander.Content>
  61. <Grid>
  62. <Grid.RowDefinitions>
  63. <RowDefinition Height="auto"/>
  64. <RowDefinition Height="auto"/>
  65. <RowDefinition Height="auto"/>
  66. </Grid.RowDefinitions>
  67. <RadioButton Grid.Row="0">基本资料</RadioButton>
  68. <RadioButton Grid.Row="1">往来单位</RadioButton>
  69. <RadioButton Grid.Row="2">上游供应商</RadioButton>
  70. </Grid>
  71. </Expander.Content>
  72. </Expander>
  73. </StackPanel>

另外,通过ExpandDirection属性可控其展开的方向。

  1. <Expander VerticalAlignment="Stretch" ExpandDirection="Right" HorizontalContentAlignment="Left" SnapsToDevicePixels="True">
  2. ............
  3. </Expander>

继续聊WPF——Expander控件(1)的更多相关文章

  1. 继续聊WPF——Expander控件(2)

    <Window x:Class="Expander_Sample2.Window1" xmlns="http://schemas.microsoft.com/win ...

  2. WPF Expander控件(扩展面板)

    这算是我比较喜欢的一个控件,以前在Winform中也常用类似的.它包装了一块内容,通过单击一个小箭头按钮可以显示或隐藏所包含的内容.在线帮助以及Web页面经常使用这种技术,因为既可以包含大量内容,而又 ...

  3. 继续聊WPF——Thumb控件

    这个控件,真不好介绍,MSDN上也是草草几句,反正就是可以让用户拖动的玩意儿,但是,你会发现,当你在该控件上拖动时,它没有反响,也就是说这个东西默认不做任何操作的,它是赖在那里什么都不干,除非你去踢上 ...

  4. WPF中Expander控件样式,ListBox的样式(带checkbox)恢复

    Expander控件样式: <ControlTemplate x:Key="ExpanderToggleButton" TargetType="ToggleButt ...

  5. 《WPF》Expander控件简单美化

    示例图: Expander控件功能很常见, 一般用于系统左侧的菜单收缩面板. 1.主要的组成 一个头部(header) 和 一个 内容(content) 组成. <Expander Expand ...

  6. 迟到的 WPF 学习 —— 控件

    这一章书中内容比较多而杂,但每个对象的内容又相对简短,所以只挑选里边有代表性的内容做记录. 1. Label 控件:一个基础的简单的 ContentControl,Labe 支持快捷键文本的设置,可以 ...

  7. 在 UWP 中实现 Expander 控件

    WPF 中的 Expander 控件在 Windows 10 SDK 中并不提供,本文主要说明,如何在 UWP 中创建这样一个控件.其效果如下图: 首先,分析该控件需要的一些特性,它应该至少包括如下三 ...

  8. WPF Popup 控件导致被遮挡内容不刷新的原因

    WPF Popup 控件导致被遮挡内容不刷新的原因 周银辉 今天在写一个WPF控件时用到了Popup控件,很郁闷的情况是:当popup关闭时,原来被popup挡住的界面部分不刷新,非要手动刷新一下(比 ...

  9. 创建 WPF 工具箱控件

    创建 WPF 工具箱控件 WPF (Windows Presentation Framework) 工具箱控件模板允许您创建 WPF 控件,会自动添加到 工具箱 安装扩展的安装. 本主题演示如何使用模 ...

随机推荐

  1. 開始学习hadoop

    思前想后,还是准备自学hadoop,作为一个初级的linux学员,更不懂什么是云.hadoop仅仅知道是个框架和基础平台,详细什么玩意也得慢慢学习了解,但还是明确他的重要性.公司近期也在内部招聘这方面 ...

  2. UVa 10693 - Traffic Volume

    題目:車速為v,車之間的距離最少為v^2/(2f)(防止裝車),車長為L,問1小時最多能走過幾輛車. 分析:數學.物理.             根據題意能够列出方程:nL + (n-1)d = nL ...

  3. C# SuperWebSocket服务端、客户端学习(三)

    1.打开VS2012,新建一个windows窗体程序,选择.NET4.0版本 2.添加引用 SuperSocket的dll文件( SuperSocket.Common.dll, SuperSocket ...

  4. 【POJ 2248】 Addition Chain

    [题目链接] http://poj.org/problem?id=2248 [算法] 搜索剪枝 剪枝1 : 优化搜索顺序,从大到小枚举 剪枝2 : Ai + Aj可能相等,只需搜一次即可 剪枝3 : ...

  5. 【BZOJ 1230】 开关灯

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=1230 [算法] 线段树 [代码] #include<bits/stdc++.h ...

  6. 洛谷 P3959 NOIP2017 宝藏 —— 状压搜索

    题目:https://www.luogu.org/problemnew/show/P3959 搜索: 不是记忆化,而是剪枝: 邻接矩阵存边即可,因为显然没有那么多边. 代码如下: #include&l ...

  7. leetcode矩阵与动态规划相关

    目录 54/59螺旋矩阵 62不同路径 64最小路径和 120三角形最小路径和 695岛屿的最大面积 547朋友圈 718最长重复数组 221最大正方形 121/122/123/714/188买卖股票 ...

  8. XML案例(使用JAXP进行DOM解析)

    1.book.xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> ...

  9. Django基础必备三件套: HttpResponse render redirect

    1. HttpResponse :  它的作用是内部传入一个字符串参数, 然后发给浏览器 def index(request): return HttpResponse('ok') 2. render ...

  10. POJ 3322 Bloxorz I

    首先呢 这个题目的名字好啊 ORZ啊 如果看不懂题意的话 请戳这里 玩儿几盘就懂了[微笑] http://www.albinoblacksheep.com/games/bloxorz 就是这个神奇的木 ...