Skip to content
Open
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
24 changes: 21 additions & 3 deletions source/Components/AvalonDock/Layout/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/************************************************************************
/************************************************************************
AvalonDock

Copyright (C) 2007-2013 Xceed Software Inc.
Expand Down Expand Up @@ -70,8 +70,8 @@ public static AnchorSide GetSide(this ILayoutElement element)
if (layoutPanel != null && layoutPanel.Children.Count > 0)
{
if (layoutPanel.Orientation == System.Windows.Controls.Orientation.Horizontal)
return layoutPanel.Children[0].Equals(element) || layoutPanel.Children[0].Descendents().Contains(element) ? AnchorSide.Left : AnchorSide.Right;
return layoutPanel.Children[0].Equals(element) || layoutPanel.Children[0].Descendents().Contains(element) ? AnchorSide.Top : AnchorSide.Bottom;
return element.InAnchorablePaneAtStartOfPanel(layoutPanel) ? AnchorSide.Left : AnchorSide.Right;
return element.InAnchorablePaneAtStartOfPanel(layoutPanel) ? AnchorSide.Top : AnchorSide.Bottom;
}
}
Debug.Fail("Unable to find the side for an element, possible layout problem!");
Expand Down Expand Up @@ -116,6 +116,24 @@ internal static void KeepInsideNearestMonitor_Issue20(this ILayoutElementForFloa
paneInsideFloatingWindow.FloatingTop = monitorInfo.Work.Bottom - (paneInsideFloatingWindow.FloatingHeight + 10);
}

private static bool InAnchorablePaneAtStartOfPanel(this ILayoutElement element, LayoutPanel layoutPanel)
{
foreach (var child in layoutPanel.Children)
{
if (!(child is LayoutAnchorablePane || child is LayoutAnchorablePaneGroup))
{
return false;
}

if (child.Equals(element) || child.Descendents().Contains(element))
{
return true;
}
}

return false;
}

#endregion Internal Methods
}
}