Skip to content

Commit

Permalink
Merge pull request #255 from Khaos66/master
Browse files Browse the repository at this point in the history
Don't create FloatingWindows twice
  • Loading branch information
Dirkster99 authored Apr 5, 2021
2 parents c272316 + 87408e2 commit fd67a5f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions source/Components/AvalonDock/DockingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,9 @@ internal UIElement CreateUIElementForModel(ILayoutElement model)
};
newFW.SetParentToMainWindowOf(this);

// Fill list before calling Show (issue #254)
_fwList.Add(newFW);

// Floating Window can also contain only Pane Groups at its base (issue #27) so we check for
// RootPanel (which is a LayoutAnchorablePaneGroup) and make sure the window is positioned back
// in current (or nearest) monitor
Expand Down Expand Up @@ -1602,6 +1605,9 @@ internal UIElement CreateUIElementForModel(ILayoutElement model)
};
newFW.SetParentToMainWindowOf(this);

// Fill list before calling Show (issue #254)
_fwList.Add(newFW);

var paneForExtensions = modelFW.RootPanel;
if (paneForExtensions != null)
{
Expand Down Expand Up @@ -1957,10 +1963,10 @@ private void DockingManager_Loaded(object sender, RoutedEventArgs e)
}
_fwHiddenList.Clear();

// load floating windows not already loaded! (issue #59)
// load floating windows not already loaded! (issue #59 & #254)
var items = new List<LayoutFloatingWindow>(Layout.FloatingWindows.Where(fw => !_fwList.Any(fwc => fwc.Model == fw)));
foreach (var fw in items)
_fwList.Add(CreateUIElementForModel(fw) as LayoutFloatingWindowControl);
CreateUIElementForModel(fw);

//create the overlaywindow if it's possible
if (IsVisible)
Expand Down

0 comments on commit fd67a5f

Please sign in to comment.