What does RowDefinition Height="10*" mean in a XAML Grid?
Solution 1:
"*"
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.
Solution 2:
I found the info below from Christian Mosers to be helpful since the Auto, and Fixed sizes on other cells rows or columns will influence the behavior of the * size. See http://wpftutorial.net/GridLayout.html
Fixed Fixed size of logical units (1/96 inch)
Auto Takes as much space as needed by the contained control
Star(*) Takes as much space as available (after filling all auto and fixed sized columns), proportionally divided over all star-sized columns. So 3*/5* means the same as 30*/50*. Remember that star-sizing does not work if the grid size is calculated based on its content.
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
</Grid>