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

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

  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.   
  4.  </Expander>  



  

转载于:https://www.cnblogs.com/xieweikai/p/6832754.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值