Roberto Salemi

Roberto Salemi

  • NA
  • 146
  • 141.9k

[WPF] Grid: set height * of row from Code Behind

May 20 2015 11:36 AM
Hi,
I have this definition:
<Grid Height="Auto" Width="Auto" Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="2"/>
<RowDefinition Height="auto" />
<RowDefinition Height="35" />
</Grid.RowDefinitions>
....
The MainGrid.RowDefinitions[1].Height is *
How can I set the height of the Row from CodeBehind?
The code should be:
MainGrid.RowDefinitions[1].Height = new GridLength(??, GridUnitType.Star);
but where there is "??" what is the correct value?
Thanks.

Answers (2)