跳到主要内容
版本:11.0.0

UniformGrid

The UniformGrid divides the available space evenly in both directions, into cells. You can specify how many divisions to use, and these can be different in either direction.

You can then allocate child controls to the cells created, using attached row and column index properties (zero-based).

Useful Properties

You will probably use these properties most often:

PropertyDescription
RowsInteger. Sets the number of equal rows in the height.
ColumnsInteger. Sets the number of equal columns in the width
Grid.ColumnAttached to a child control to set its column index.
Grid.RowAttached to a child control to set its row index.

Example

<UniformGrid Rows="1" Columns="3" Width="300" Height="200">
<Rectangle Fill="navy" Grid.Column="0" Grid.Row="0"/>
<Rectangle Fill="white" Grid.Column="1" Grid.Row="0"/>
<Rectangle Fill="red" Grid.Column="2" Grid.Row="0"/>
</UniformGrid>

More Information

信息

For the complete API documentation about this control, see here.

信息

View the source code on GitHub UniformGrid.cs