文章目錄
- 前言
- 一、引言
- 二、使用步驟
前言
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>
效果圖