Index: Core/Common/src/Core.Common.Gui/Forms/ViewHost/AvalonDockViewHost.xaml =================================================================== diff -u -rd01312423392d6b8af4102f251ad59fcacbe7895 -r22bfc7d1330c3602f2e81cb158c2ce3f13325905 --- Core/Common/src/Core.Common.Gui/Forms/ViewHost/AvalonDockViewHost.xaml (.../AvalonDockViewHost.xaml) (revision d01312423392d6b8af4102f251ad59fcacbe7895) +++ Core/Common/src/Core.Common.Gui/Forms/ViewHost/AvalonDockViewHost.xaml (.../AvalonDockViewHost.xaml) (revision 22bfc7d1330c3602f2e81cb158c2ce3f13325905) @@ -29,19 +29,19 @@ - - + + - - + + - - + + - - + + Index: Core/Common/src/Core.Common.Gui/Forms/ViewHost/AvalonDockViewHost.xaml.cs =================================================================== diff -u -re453a75b0515e243e126c0b71474ee387db64d2b -r22bfc7d1330c3602f2e81cb158c2ce3f13325905 --- Core/Common/src/Core.Common.Gui/Forms/ViewHost/AvalonDockViewHost.xaml.cs (.../AvalonDockViewHost.xaml.cs) (revision e453a75b0515e243e126c0b71474ee387db64d2b) +++ Core/Common/src/Core.Common.Gui/Forms/ViewHost/AvalonDockViewHost.xaml.cs (.../AvalonDockViewHost.xaml.cs) (revision 22bfc7d1330c3602f2e81cb158c2ce3f13325905) @@ -127,7 +127,7 @@ documentViews.Add(view); hostControls.Add(hostControl); - documentPane.Children.Add(layoutDocument); + AddLayoutDocument(layoutDocument); SetFocusToView(view); @@ -163,18 +163,7 @@ toolViews.Add(view); hostControls.Add(hostControl); - switch (toolViewLocation) - { - case ToolViewLocation.Left: - leftPane.Children.Add(layoutAnchorable); - break; - case ToolViewLocation.Bottom: - bottomPane.Children.Add(layoutAnchorable); - break; - case ToolViewLocation.Right: - rightPane.Children.Add(layoutAnchorable); - break; - } + AddLayoutAnchorable(layoutAnchorable, toolViewLocation); SetFocusToView(view); @@ -363,6 +352,37 @@ .FirstOrDefault(d => GetView(d.Content) == view); } + private void AddLayoutDocument(LayoutDocument layoutDocument) + { + layoutDocumentPaneGroup.Descendents() + .OfType() + .First() + .Children.Add(layoutDocument); + } + + private void AddLayoutAnchorable(LayoutAnchorable layoutAnchorable, ToolViewLocation toolViewLocation) + { + var layoutAnchorablePaneGroup = new LayoutAnchorablePaneGroup(); + + switch (toolViewLocation) + { + case ToolViewLocation.Left: + layoutAnchorablePaneGroup = leftLayoutAnchorablePaneGroup; + break; + case ToolViewLocation.Bottom: + layoutAnchorablePaneGroup = bottomLayoutAnchorablePaneGroup; + break; + case ToolViewLocation.Right: + layoutAnchorablePaneGroup = rightLayoutAnchorablePaneGroup; + break; + } + + layoutAnchorablePaneGroup.Descendents() + .OfType() + .First() + .Children.Add(layoutAnchorable); + } + private static IView GetView(object content) { var windowsFormsHost = content as WindowsFormsHost; Index: Core/Common/test/Core.Common.Gui.Test/Forms/ViewHost/AvalonDockViewHostTest.cs =================================================================== diff -u -r223b2a4edc4ac816051c7eeecb735c34a6246574 -r22bfc7d1330c3602f2e81cb158c2ce3f13325905 --- Core/Common/test/Core.Common.Gui.Test/Forms/ViewHost/AvalonDockViewHostTest.cs (.../AvalonDockViewHostTest.cs) (revision 223b2a4edc4ac816051c7eeecb735c34a6246574) +++ Core/Common/test/Core.Common.Gui.Test/Forms/ViewHost/AvalonDockViewHostTest.cs (.../AvalonDockViewHostTest.cs) (revision 22bfc7d1330c3602f2e81cb158c2ce3f13325905) @@ -798,9 +798,13 @@ private static bool IsDocumentViewPresent(AvalonDockViewHost avalonDockViewHost, IView documentView) { - var documentPane = TypeUtils.GetField(avalonDockViewHost, "documentPane"); + var layoutDocumentPaneGroup = TypeUtils.GetField(avalonDockViewHost, "layoutDocumentPaneGroup"); - return documentPane.Children.Any(c => ((WindowsFormsHost) c.Content).Child == documentView); + return layoutDocumentPaneGroup.Descendents() + .OfType() + .First() + .Children + .Any(c => ((WindowsFormsHost) c.Content).Child == documentView); } private static bool IsToolViewPresent(AvalonDockViewHost avalonDockViewHost, IView toolView, ToolViewLocation toolViewLocation) @@ -810,22 +814,26 @@ switch (toolViewLocation) { case ToolViewLocation.Left: - paneField = "leftPane"; + paneField = "leftLayoutAnchorablePaneGroup"; break; case ToolViewLocation.Right: - paneField = "rightPane"; + paneField = "rightLayoutAnchorablePaneGroup"; break; case ToolViewLocation.Bottom: - paneField = "bottomPane"; + paneField = "bottomLayoutAnchorablePaneGroup"; break; default: paneField = ""; break; } - var layoutAnchorablePaneGroup = TypeUtils.GetField(avalonDockViewHost, paneField); + var layoutAnchorablePaneGroup = TypeUtils.GetField(avalonDockViewHost, paneField); - return layoutAnchorablePaneGroup.Children.Any(c => ((WindowsFormsHost) c.Content).Child == toolView); + return layoutAnchorablePaneGroup.Descendents() + .OfType() + .First() + .Children + .Any(c => ((WindowsFormsHost) c.Content).Child == toolView); } private static bool IsFocussedView(AvalonDockViewHost avalonDockViewHost, IView view)