From 3c306178c19ed42d7e18dd2db7cbf313c5a22bcc Mon Sep 17 00:00:00 2001 From: Dmitry Vodich Date: Tue, 17 Dec 2019 15:38:34 +0300 Subject: [PATCH] Fix #101 and new fix for #81 with docked pane becomes not visible. --- .../AvalonDock/Controls/LayoutGridControl.cs | 4 ---- source/Components/AvalonDock/Layout/LayoutGroup.cs | 12 +++++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/Components/AvalonDock/Controls/LayoutGridControl.cs b/source/Components/AvalonDock/Controls/LayoutGridControl.cs index 8a2e5a08..1d896730 100644 --- a/source/Components/AvalonDock/Controls/LayoutGridControl.cs +++ b/source/Components/AvalonDock/Controls/LayoutGridControl.cs @@ -600,10 +600,6 @@ public virtual void AdjustFixedChildrenPanelSizes(Size? parentSize = null) { child.AdjustFixedChildrenPanelSizes(availableSize); } - - // #81 - Make parents update their children up the tree. Otherwise, they will not be redrawn. - if (parentSize == null) - _model.RaiseChildrenTreeChanged(); } private FrameworkElement GetNextVisibleChild(int index) diff --git a/source/Components/AvalonDock/Layout/LayoutGroup.cs b/source/Components/AvalonDock/Layout/LayoutGroup.cs index ca600071..9f15d2c6 100644 --- a/source/Components/AvalonDock/Layout/LayoutGroup.cs +++ b/source/Components/AvalonDock/Layout/LayoutGroup.cs @@ -268,7 +268,17 @@ private void _children_CollectionChanged(object sender, System.Collections.Speci ComputeVisibility(); OnChildrenCollectionChanged(); - NotifyChildrenTreeChanged(ChildrenTreeChange.DirectChildrenChanged); + + if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) + { + // #81 - Make parents update their children up the tree. Otherwise, they will not be redrawn. + RaiseChildrenTreeChanged(); + } + else + { + NotifyChildrenTreeChanged(ChildrenTreeChange.DirectChildrenChanged); + } + RaisePropertyChanged("ChildrenCount"); }