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:
Property | Description |
---|---|
Rows | Integer. Sets the number of equal rows in the height. |
Columns | Integer. Sets the number of equal columns in the width |
Grid.Column | Attached to a child control to set its column index. |
Grid.Row | Attached 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