<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Ellipse Grid.Column="0" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="120" Height="120" Fill="Yellow"/>
<Line Grid.Column="0" Grid.Row="1" X1="10" Y1="5" X2="135" Y2="125" Stroke="Pink" StrokeThickness="20"/>
<Button Grid.Column="0" Grid.Row="2" Content="王wx" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Polygon Grid.Column="1" Grid.Row="0" StrokeLineJoin="Miter" StrokeStartLineCap="Round" Fill="Blue" >
<Polygon.Points>
<Point X="5" Y="6"/>
<Point X="26" Y="75" />
<Point X="87" Y="165" />
<Point X="128" Y="12"/>
</Polygon.Points>
</Polygon>
<CheckBox Grid.Column="1" Grid.Row="1" Content="wwx try" />
<TextBlock Grid.Column="1" Grid.Row="2" Text="yoyo wwx" FontSize="30" VerticalAlignment="Center"/>
<Rectangle Grid.Column="2" Grid.Row="0" Fill="Gray" HorizontalAlignment="Center" VerticalAlignment="Center" Height="85" Width="118" />
<Path Grid.Column="2" Grid.Row="1" Fill="Orange" Data=" M 2,8 L 45,60 c 80,95 140,175 125,30 z" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
<Slider Grid.Column="2" Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
</Grid>
通过对行列的分割来进行定位,首先通过
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
来进行列的分割
然后通过
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
来进行 行的分割
然后在相应的子节点中的属性,Grid.Column="0" Grid.Row=“2" 来分别设置在第几个快中,或者跨快。