Wpf布局之WrapPanel面板!
文章目录
- 前言
- 一、引言
- 二、使用步骤
前言
Wpf布局之WrapPanel面板!
一、引言
WrapPanel面板以一次一行或一列的方式布置控件!
二、使用步骤
WrapPanel面板Orientation属性默认是"Horizontal",将控件从左向右进行排列,一行中排列不下后,再在下一行排列。
<Grid><WrapPanel><Button Width="100" Height="100"/><Button Width="100" Height="100"/><Button Width="100" Height="100"/><Button Width="100" Height="100"/><Button Width="100" Height="100"/></WrapPanel>
</Grid>
效果图,这是一行排布的下。
这是一行排布不下。
WrapPanel面板Orientation属性设置为"Vertical"后,将控件从第一列开始排布,第一列排布不下后放到第二排。
<Grid><WrapPanel Orientation="Vertical"><Button Width="100" Height="100"/><Button Width="100" Height="100"/><Button Width="100" Height="100"/><Button Width="100" Height="100"/><Button Width="100" Height="100"/></WrapPanel>
</Grid>
效果图