Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions source/Components/AvalonDock/Controls/LayoutDocumentTabItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,16 @@ protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
base.OnMouseLeftButtonDown(e);
CaptureMouse();
_allowDrag = false;
Model.IsActive = true;
if (Model is LayoutDocument layoutDocument && !layoutDocument.CanMove) return;
if (Model != null)
{
Model.IsActive = true;
}

if (Model is LayoutDocument layoutDocument && !layoutDocument.CanMove)
{
return;
}

if (e.ClickCount != 1) return;
_mouseDownPoint = e.GetPosition(this);
_isMouseDown = true;
Expand Down Expand Up @@ -147,10 +155,10 @@ protected override void OnMouseMove(MouseEventArgs e)
var containerPane = Model.Parent as ILayoutPane;

if (containerPane is LayoutDocumentPane layoutDocumentPane && !layoutDocumentPane.CanRepositionItems) return;
if (containerPane.Parent is LayoutDocumentPaneGroup layoutDocumentPaneGroup && !layoutDocumentPaneGroup.CanRepositionItems) return;
if (containerPane?.Parent is LayoutDocumentPaneGroup layoutDocumentPaneGroup && !layoutDocumentPaneGroup.CanRepositionItems) return;

var childrenList = container.Children.ToList();
containerPane.MoveChild(childrenList.IndexOf(Model), childrenList.IndexOf(targetModel));
containerPane?.MoveChild(childrenList.IndexOf(Model), childrenList.IndexOf(targetModel));
Model.IsActive = true;
_parentDocumentTabPanel.UpdateLayout();
UpdateDragDetails();
Expand Down