Index: Core/Common/src/Core.Common.Gui/Forms/ViewHost/AvalonDockViewHost.xaml.cs =================================================================== diff -u -r91ae1375d1496061f2c548ff2f533e944eaa7855 -r6c131e496f74044bbd7cf44d09ed1bef9224d988 --- Core/Common/src/Core.Common.Gui/Forms/ViewHost/AvalonDockViewHost.xaml.cs (.../AvalonDockViewHost.xaml.cs) (revision 91ae1375d1496061f2c548ff2f533e944eaa7855) +++ Core/Common/src/Core.Common.Gui/Forms/ViewHost/AvalonDockViewHost.xaml.cs (.../AvalonDockViewHost.xaml.cs) (revision 6c131e496f74044bbd7cf44d09ed1bef9224d988) @@ -131,12 +131,9 @@ Content = hostControl }; - PerformWithoutChangingActiveContent(() => - { - AddLayoutDocument(layoutDocument); - }); + PerformWithoutChangingActiveContent(() => { AddLayoutDocument(layoutDocument); }); - BringToFront(view); + BringToFront(layoutDocument); documentViews.Add(view); hostControls.Add(hostControl); @@ -171,12 +168,9 @@ Title = view.Text }; - PerformWithoutChangingActiveContent(() => - { - AddLayoutAnchorable(layoutAnchorable, toolViewLocation); - }); + PerformWithoutChangingActiveContent(() => { AddLayoutAnchorable(layoutAnchorable, toolViewLocation); }); - BringToFront(view); + BringToFront(layoutAnchorable); toolViews.Add(view); hostControls.Add(hostControl); @@ -209,21 +203,13 @@ public void BringToFront(IView view) { - PerformWithoutChangingActiveContent(() => - { - LayoutContent layoutContent = documentViews.Contains(view) - ? (LayoutContent) GetLayoutContent(view) - : toolViews.Contains(view) - ? GetLayoutContent(view) - : null; + LayoutContent layoutContent = documentViews.Contains(view) + ? (LayoutContent) GetLayoutContent(view) + : toolViews.Contains(view) + ? GetLayoutContent(view) + : null; - if (layoutContent != null && !layoutContent.IsActive) - { - layoutContent.IsActive = true; - } - - UpdateDockingManager(); - }); + BringToFront(layoutContent); } public void SetImage(IView view, Image image) @@ -243,6 +229,19 @@ } } + private void BringToFront(LayoutContent layoutContent) + { + PerformWithoutChangingActiveContent(() => + { + if (layoutContent != null && !layoutContent.IsActive) + { + layoutContent.IsActive = true; + + UpdateDockingManager(); + } + }); + } + private void OnLostFocus(object sender, RoutedEventArgs routedEventArgs) { var userControl = activeView as UserControl;