fix(docking): address final code quality issues in docking layout
This commit is contained in:
@@ -40,6 +40,7 @@ public partial class DockGroup : DockContainer
|
||||
_tabView.DragOver -= OnDragOver;
|
||||
_tabView.Drop -= OnDrop;
|
||||
_tabView.DragLeave -= OnDragLeave;
|
||||
_tabView.TabCloseRequested -= OnTabCloseRequested;
|
||||
}
|
||||
|
||||
_tabView = GetTemplateChild(PART_TAB_VIEW) as TabView;
|
||||
@@ -51,6 +52,7 @@ public partial class DockGroup : DockContainer
|
||||
_tabView.DragOver += OnDragOver;
|
||||
_tabView.Drop += OnDrop;
|
||||
_tabView.DragLeave += OnDragLeave;
|
||||
_tabView.TabCloseRequested += OnTabCloseRequested;
|
||||
}
|
||||
|
||||
UpdateTabs();
|
||||
@@ -94,6 +96,14 @@ public partial class DockGroup : DockContainer
|
||||
Root?.HideHighlight();
|
||||
}
|
||||
|
||||
private void OnTabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args)
|
||||
{
|
||||
if (args.Tab.Tag is DockDocument doc)
|
||||
{
|
||||
RemoveChild(doc);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnChildrenUpdated()
|
||||
{
|
||||
UpdateTabs();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Grid>
|
||||
<TabView x:Name="PART_TabView"
|
||||
IsAddTabButtonVisible="False"
|
||||
CanDragTabs="False"
|
||||
CanDragTabs="True"
|
||||
CanReorderTabs="False"
|
||||
AllowDrop="True">
|
||||
</TabView>
|
||||
|
||||
@@ -116,6 +116,7 @@ public class DockingLayout : Control
|
||||
|
||||
private void SplitGroup(DockGroup targetGroup, DockDocument doc, DockTarget target)
|
||||
{
|
||||
doc.Owner?.RemoveChild(doc);
|
||||
var parentPanel = targetGroup.Owner as DockPanel;
|
||||
|
||||
if (parentPanel == null)
|
||||
|
||||
Reference in New Issue
Block a user