我怎样才能平等地拉伸下面的矩形,使第一行的一半,第二行的一半,1/3 1/3 1/3分配?
<RelativePanel>
<Rectangle Fill="Blue" Margin="5" x:Name="Pm25" MinHeight="100" MinWidth="100" RelativePanel.AlignLeftWithPanel="True"/>
<Rectangle Fill="Blue" Margin="5" x:Name="Pm10" MinHeight="100" MinWidth="100" RelativePanel.AlignRightWithPanel="True"/>
<Rectangle Fill="Blue" Margin="5" x:Name="O3" RelativePanel.Below="Pm25" MinHeight="100" MinWidth="100"/>
<Rectangle Fill="Blue" Margin="5" x:Name="NO2" RelativePanel.RightOf="O3" RelativePanel.Below="Pm10" MinHeight="100" MinWidth="100"/>
<Rectangle Fill="Blue" Margin="5" x:Name="SO2" RelativePanel.RightOf="NO2" RelativePanel.Below="Pm10" MinHeight="100" MinWidth="100"/>
<Rectangle Fill="Blue" Margin="5" x:Name="CO" RelativePanel.Below="O3" MinHeight="100" MinWidth="100" RelativePanel.AlignLeftWith="Pm25" RelativePanel.AlignRightWithPanel="True"/>
</RelativePanel>
但目前它看起来像这样:
1条答案
按热度按时间np8igboo1#
对于每一行矩形,创建一个水平方向的StackPanel,并将矩形放在那里。