WPF: Hide grid row
Posted
by Richard
on Stack Overflow
See other posts from Stack Overflow
or by Richard
Published on 2010-03-23T17:31:47Z
Indexed on
2010/03/23
17:33 UTC
Read the original article
Hit count: 1362
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!
© Stack Overflow or respective owner