From 0debf58bbca8a5b722a4aee240be19a7de3ba866 Mon Sep 17 00:00:00 2001 From: Van Stonecypher Date: Fri, 22 Sep 2023 13:37:11 -0500 Subject: [PATCH] Do not add FloatingWindow to _fwList a second time in OnLayoutChanged. --- source/Components/AvalonDock/DockingManager.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/Components/AvalonDock/DockingManager.cs b/source/Components/AvalonDock/DockingManager.cs index 8c7ca9d0..c777f588 100644 --- a/source/Components/AvalonDock/DockingManager.cs +++ b/source/Components/AvalonDock/DockingManager.cs @@ -219,9 +219,10 @@ protected virtual void OnLayoutChanged(LayoutRoot oldLayout, LayoutRoot newLayou RightSidePanel = CreateUIElementForModel(Layout.RightSide) as LayoutAnchorSideControl; BottomSidePanel = CreateUIElementForModel(Layout.BottomSide) as LayoutAnchorSideControl; - foreach (var fw in Layout.FloatingWindows.ToArray()) - if (fw.IsValid) - _fwList.Add(CreateUIElementForModel(fw) as LayoutFloatingWindowControl); + foreach (var fw in Layout.FloatingWindows.Where(x => x.IsValid).ToArray()) + { + CreateUIElementForModel(fw); + } foreach (var fw in _fwList.ToArray()) {