布局篇-StackPanel布局
StackPanel可以把内部元素在纵向或横向上紧凑排列,形成栈式布局
属性名称 | 数据类型 | 可取值 | 描述 | ||||
Orientation | Orientation枚举 |
|
决定内部元素是横向累积还是纵向累积 | ||||
HorizontalAlignment | HorizontalAlignment枚举 |
|
决定内部元素水平方向上的对齐方式 | ||||
VerticalAlignment | VerticalAlignment |
|
决定内部元素竖直方向上的对齐方式 |
实例代码
- <Grid>
- <GroupBox Header="请选择没有错别字的成语" BorderBrush="Black" Margin="5">
- <StackPanel Margin="5" Height="271">
- <CheckBox Content="A.迫不及待" />
- <CheckBox Content="B.首屈一指" />
- <CheckBox Content="C.陈词滥调" />
- <CheckBox Content="D.不可理喻" />
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
- <Button Content="清空" Width="60" Margin="5" />
- <Button Content="确定" Width="60" Margin="5" />
- </StackPanel>
- </StackPanel>
- </GroupBox>
- </Grid>
效果如图:
posted on 2017-07-26 08:47 alex5211314 阅读(183) 评论(0) 编辑 收藏 举报