Collapse Grid Row In WPF
Answer : All you need is something to cache the height(s) of the visible row. After that, you no longer need converters or to toggle visibility of contained controls. CollapsibleRow public class CollapsibleRow : RowDefinition { #region Fields private GridLength cachedHeight; private double cachedMinHeight; #endregion #region Dependency Properties public static readonly DependencyProperty CollapsedProperty = DependencyProperty.Register("Collapsed", typeof(bool), typeof(CollapsibleRow), new PropertyMetadata(false, OnCollapsedChanged)); private static void OnCollapsedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if(d is CollapsibleRow row && e.NewValue is bool collapsed) { if(collapsed) { if(row.MinHeight != 0) { row.cachedMinHeight = row.MinHeight; row.MinHeight = 0; } ...