WPF: Hide grid row
- by Richard
Hi All,
I have a simple WPF form with a <Grid> declared on the Form.
In this Grid I then have a bunch of Rows:
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="30" />
<RowDefinition Height="Auto" Name="rowToHide"/>
<RowDefinition Height="Auto" MinHeight="30" />
</Grid.RowDefinitions>
So basically the row with the name "rowToHide" has a few input fields in it, and now I want to hide this row as I don't need these fields. Its simple enough to just set all items in the Row to Visibility = Hidden, but the Row still takes up space in the Grid. So need to do something like setting Height = 0 or something. But that didn't seem to work.
You can think of it like this: You have a form, in there we have a drop down saying "Payment Type", and if the person selects "Cash", then hide the row containing the Card details. And it isn't an option to start the form with this hidden already.
Thanks everyone!