I have a Grid with some rows. The height of the rows are set relatively to the window size like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.3*" />
<RowDefinition Height="0.2*" />
<RowDefinition Height="0.2*" />
<RowDefinition Height="0.1*" /> <!-- hide this row -->
<RowDefinition Height="0.2*" />
</Grid.RowDefinitions>
</Grid>
Now i want to hide the content of one row based on a binded property. Therefore I set the Visiblity Property of the content object to Collapsed. The Visiblity of the content works fine but the row still needs the original space.
Is there a way to hide the row when Visiblity of the content is collapsed? Note: I don’t want to set the Height in the RowDefinition to Auto because so I can’t set the Height relatively to the Window size and the height of the row gets adjustet to the height of the content inside the row.
You could bind the Height property of the row to the binded property.
Then you need a converter (implementation of IValueConverter) from typeof(binded property) to System.Windows.GridLength.
Perhaps something like