Skip to content

Commit

Permalink
Fix for Issue #27 Reposition Floating Window based on LayoutAnchorabl…
Browse files Browse the repository at this point in the history
…ePane OR LayoutAnchorablePaneGroup as RootLayout Element

#27
  • Loading branch information
Dirkster99 committed May 10, 2019
1 parent fbd9266 commit 1f5cf8b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions source/Components/Xceed.Wpf.AvalonDock/DockingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,6 +2080,21 @@ internal UIElement CreateUIElementForModel( ILayoutElement model )
newFW.Width = paneForExtensions.FloatingWidth;
newFW.Height = paneForExtensions.FloatingHeight;
}
else
{
// Floating Window can also contain only Pane Groups at its base (issue #27) so we check for that
// and make sure the window is position back to where it was before (or the nearest monitor)
var panegroup = modelFW.RootPanel.Children.OfType<LayoutAnchorablePaneGroup>().FirstOrDefault();
if (panegroup != null)
{
panegroup.KeepInsideNearestMonitor(); // Check position is valid in current setup

newFW.Left = panegroup.FloatingLeft; // Position the window to previous or nearest valid position
newFW.Top = panegroup.FloatingTop;
newFW.Width = panegroup.FloatingWidth;
newFW.Height = panegroup.FloatingHeight;
}
}

newFW.ShowInTaskbar = false;

Expand Down

0 comments on commit 1f5cf8b

Please sign in to comment.