Reputation: 18068
I would like to make a UniformGrid take 70% of total window width and 80% of total window height. How achieve it?
<UniformGrid x:Name="Grid" Margin="20,0,0,0">
</UniformGrid>
Upvotes: 7
Views: 8887
Reputation: 2995
Like the other answer suggests, you first create a Grid like so:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="8*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="7*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<UniformGrid x:Name="yourGrid">
</UniformGrid>
</Grid>
Then you set your UniformGrid control as the child in the 0th row 0th column of the main grid. The x* notation means that you want x parts of the screen used in the row/column, so splitting rows at 8*/2* splits them at 80%/20% and splitting columns and 7*/3* splits them at 70%/30%. I hope that clears it up for you.
Upvotes: 7