Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does RowDefinition Height="10*" mean in a XAML Grid?

Tags:

wpf

xaml

grid

I use Height="*" a bit to mean that the height of the last row should fill to the bottom of the grid.

But what does "10*" mean?

<Grid Name="mainGrid">     <Grid.RowDefinitions>         <RowDefinition Height="100" />         <RowDefinition Height="40" />         <RowDefinition Height="10*" />     </Grid.RowDefinitions>     <Grid.ColumnDefinitions>         <ColumnDefinition Width="200"  />         <ColumnDefinition Width="*" />     </Grid.ColumnDefinitions> </Grid> 
like image 961
Edward Tanguay Avatar asked Jul 22 '09 09:07

Edward Tanguay


People also ask

How Grid works in XAML?

The Grid element in XAML represents a WPF Grid control. The following code snippet creates a Grid control, sets it width and foreground color and make sure grid lines are visible. The ColumnDefinitions property is used to add columns and the RowDefinitions property is used to add rows to a Grid.


1 Answers

"*" is shorthand for "1*". It's a ratio, so if you have two rows, one with "*" and one with "10*", the former gets 1/11th of the available and the latter gets 10/11th of the space.

In your example above, "10*" is unnecessary - "*" would make more sense because there is only one row using ratio-based sizing, so any ratio will equate to 100% of the available space.

like image 70
Kent Boogaart Avatar answered Sep 19 '22 03:09

Kent Boogaart