using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; namespace QuikDawEditor; public class HideableGridSplitter : GridSplitter { private GridLength heightTop = new GridLength(6, GridUnitType.Star); private GridLength heightBottom = new GridLength(4, GridUnitType.Star); public HideableGridSplitter() { this.IsVisibleChanged += HideableGridSplitter_IsVisibleChanged; } void HideableGridSplitter_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { Grid parent = base.Parent as Grid; if (parent == null) return; var topRow = parent.RowDefinitions[0]; var splitterRow = parent.RowDefinitions[1]; var botRow = parent.RowDefinitions[2]; if (this.Visibility == Visibility.Visible) { topRow.Height = heightTop; botRow.Height = heightBottom; splitterRow.Height = new GridLength(10); } else { topRow.Height = new GridLength(10, GridUnitType.Star); botRow.Height = new GridLength(0, GridUnitType.Star); splitterRow.Height = new GridLength(0); } } }