private static void AddGridSplitterBindings(GridSplitter gridSplitter, DisplayContainer previousContainer, DisplayContainer nextContainer) { MultiBinding multiBinding = new MultiBinding() { Converter = new BooleanAndConverter() }; // A splitter is disabled if either the container above or below it has its content collapsed var booleanToNotBooleanConverter = new BooleanToNotBooleanConverter(); multiBinding.Bindings.Add(new Binding(nameof(previousContainer.IsContentCollapsed)) { Source = previousContainer, Converter = booleanToNotBooleanConverter }); multiBinding.Bindings.Add(new Binding(nameof(nextContainer.IsContentCollapsed)) { Source = nextContainer, Converter = booleanToNotBooleanConverter }); gridSplitter.SetBinding(GridSplitter.IsEnabledProperty, multiBinding); }
private RowDefinition GetRowDefinitionForContainer(DisplayContainer container) { var row = Grid.GetRow(container); return(this.grid.RowDefinitions.ElementAt(row)); }
/// <summary> /// Add any bindings between the row and the DisplayContainer hosted in that row. /// </summary> private static void AddContainerRowDefinitionBindings(CollapsibleRowDefinition rowDefinitionForContainer, DisplayContainer displayContainer) { var isCollapsedBinding = new Binding() { Source = displayContainer, Path = new PropertyPath(nameof(displayContainer.IsContentCollapsed)) }; BindingOperations.SetBinding(rowDefinitionForContainer, CollapsibleRowDefinition.IsCollapsedProperty, isCollapsedBinding); }