diff --git a/src/Editor/Ghost.Editor/View/Controls/Docking/DockRegionHighlight.xaml b/src/Editor/Ghost.Editor/View/Controls/Docking/DockRegionHighlight.xaml index 99023f1..1959f90 100644 --- a/src/Editor/Ghost.Editor/View/Controls/Docking/DockRegionHighlight.xaml +++ b/src/Editor/Ghost.Editor/View/Controls/Docking/DockRegionHighlight.xaml @@ -7,7 +7,7 @@ - + diff --git a/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs b/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs index 97754ff..a854c66 100644 --- a/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs +++ b/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs @@ -34,14 +34,23 @@ public class DockingLayout : Control private static void OnRootPanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - if (d is DockingLayout layout && e.NewValue is DockPanel panel) + if (d is DockingLayout layout) { - panel.Root = layout; + if (e.OldValue is DockPanel oldPanel) + { + oldPanel.Root = null; + } + + if (e.NewValue is DockPanel newPanel) + { + newPanel.Root = layout; + } } } public void AddDocument(DockDocument document, DockTarget target, DockGroup? targetGroup = null) { + // TODO: Handle non-Center targets (Task 5) if (RootPanel == null) { RootPanel = new DockPanel();