I have been hiding a row in a WPF grid by setting the Height
property to 0.
I was expecting something akin to a Visible
property.
Is there a more appropriate way to hide the row?
Just do this :
XAML :
<Grid.RowDefinitions>
<RowDefinition Height="1*" x:Name="name1" />
<RowDefinition Height="Auto" x:Name="name2" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
C# for collapse :
name1.Height = new GridLength(0);
name2.Height = new GridLength(0);
C# for visibility:
name1.Height = new GridLength(1, GridUnitType.Star);
name2.Height = GridLength.Auto;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With