Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't create FloatingWindows twice #255

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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