fix(docking): address final code quality issues in docking layout

This commit is contained in:
2026-03-28 22:57:54 +09:00
parent c52daf3914
commit 666528263b
3 changed files with 12 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ public partial class DockGroup : DockContainer
_tabView.DragOver -= OnDragOver; _tabView.DragOver -= OnDragOver;
_tabView.Drop -= OnDrop; _tabView.Drop -= OnDrop;
_tabView.DragLeave -= OnDragLeave; _tabView.DragLeave -= OnDragLeave;
_tabView.TabCloseRequested -= OnTabCloseRequested;
} }
_tabView = GetTemplateChild(PART_TAB_VIEW) as TabView; _tabView = GetTemplateChild(PART_TAB_VIEW) as TabView;
@@ -51,6 +52,7 @@ public partial class DockGroup : DockContainer
_tabView.DragOver += OnDragOver; _tabView.DragOver += OnDragOver;
_tabView.Drop += OnDrop; _tabView.Drop += OnDrop;
_tabView.DragLeave += OnDragLeave; _tabView.DragLeave += OnDragLeave;
_tabView.TabCloseRequested += OnTabCloseRequested;
} }
UpdateTabs(); UpdateTabs();
@@ -94,6 +96,14 @@ public partial class DockGroup : DockContainer
Root?.HideHighlight(); Root?.HideHighlight();
} }
private void OnTabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args)
{
if (args.Tab.Tag is DockDocument doc)
{
RemoveChild(doc);
}
}
protected override void OnChildrenUpdated() protected override void OnChildrenUpdated()
{ {
UpdateTabs(); UpdateTabs();

View File

@@ -10,7 +10,7 @@
<Grid> <Grid>
<TabView x:Name="PART_TabView" <TabView x:Name="PART_TabView"
IsAddTabButtonVisible="False" IsAddTabButtonVisible="False"
CanDragTabs="False" CanDragTabs="True"
CanReorderTabs="False" CanReorderTabs="False"
AllowDrop="True"> AllowDrop="True">
</TabView> </TabView>

View File

@@ -116,6 +116,7 @@ public class DockingLayout : Control
private void SplitGroup(DockGroup targetGroup, DockDocument doc, DockTarget target) private void SplitGroup(DockGroup targetGroup, DockDocument doc, DockTarget target)
{ {
doc.Owner?.RemoveChild(doc);
var parentPanel = targetGroup.Owner as DockPanel; var parentPanel = targetGroup.Owner as DockPanel;
if (parentPanel == null) if (parentPanel == null)