fix(docking): address code quality issues in DockingLayout and DockRegionHighlight

This commit is contained in:
2026-03-28 22:10:08 +09:00
parent baca976c6f
commit 5521a8cce2
2 changed files with 12 additions and 3 deletions

View File

@@ -7,7 +7,7 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="local:DockRegionHighlight"> <ControlTemplate TargetType="local:DockRegionHighlight">
<Border Background="#400078D7" BorderBrush="#800078D7" BorderThickness="2" CornerRadius="4" /> <Border Background="{ThemeResource SystemControlHighlightAccentBrush}" Opacity="0.25" BorderBrush="{ThemeResource SystemControlHighlightAccentBrush}" BorderThickness="2" CornerRadius="4" />
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>

View File

@@ -34,14 +34,23 @@ public class DockingLayout : Control
private static void OnRootPanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 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) public void AddDocument(DockDocument document, DockTarget target, DockGroup? targetGroup = null)
{ {
// TODO: Handle non-Center targets (Task 5)
if (RootPanel == null) if (RootPanel == null)
{ {
RootPanel = new DockPanel(); RootPanel = new DockPanel();