继续聊WPF——Expander控件(1)
2017-05-09 21:22
281 查看
这个控件最实用的地方,就是做导航栏。
<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>
<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>
相关文章推荐
- 继续聊WPF——Expander控件(2)
- 继续聊WPF——Expander控件(1)
- 继续聊WPF——Expander控件(1)
- 继续聊WPF——Expander控件(1)
- 继续聊WPF——Expander控件(2)
- 继续聊WPF——Expander控件(2)
- 继续聊WPF——Expander控件(2)
- 继续聊WPF——自定义CheckBox控件外观
- 继续聊WPF——Thumb控件
- 继续聊WPF——Thumb控件
- 继续聊WPF——自定义CheckBox控件外观
- WPF控件之Expander
- 继续聊WPF——Thumb控件
- 继续聊WPF——自定义CheckBox控件外观
- 继续聊WPF——设置网格控件列标题的样式
- 继续聊WPF——Thumb控件
- 继续聊WPF——BulletDecorator控件
- 继续聊WPF——设置网格控件列标题的样式
- 继续聊WPF——BulletDecorator控件
- 继续聊WPF——设置网格控件列标题的样式