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.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();
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user