From e8f2d465568f355dce660c608e8a2ec201491708 Mon Sep 17 00:00:00 2001 From: Muhahe Date: Fri, 8 Oct 2021 09:44:36 +0200 Subject: [PATCH 1/2] Added CaptureMouse() for drag fix #306 Mouse needs to be captured at the start, to listen mouse move events before document IsActive is set. --- source/Components/AvalonDock/Controls/LayoutDocumentTabItem.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Components/AvalonDock/Controls/LayoutDocumentTabItem.cs b/source/Components/AvalonDock/Controls/LayoutDocumentTabItem.cs index 60f53257..3f05291e 100644 --- a/source/Components/AvalonDock/Controls/LayoutDocumentTabItem.cs +++ b/source/Components/AvalonDock/Controls/LayoutDocumentTabItem.cs @@ -109,6 +109,7 @@ protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); + CaptureMouse(); _allowDrag = false; Model.IsActive = true; if (Model is LayoutDocument layoutDocument && !layoutDocument.CanMove) return; From 689e45870fed2de32a61af42fdb2c8a466e6b6c9 Mon Sep 17 00:00:00 2001 From: Muhahe Date: Fri, 8 Oct 2021 09:46:30 +0200 Subject: [PATCH 2/2] Added CaptureMouse() for window sync #306 --- .../AvalonDock/Controls/LayoutFloatingWindowControl.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Components/AvalonDock/Controls/LayoutFloatingWindowControl.cs b/source/Components/AvalonDock/Controls/LayoutFloatingWindowControl.cs index c88158a6..53ce4d98 100644 --- a/source/Components/AvalonDock/Controls/LayoutFloatingWindowControl.cs +++ b/source/Components/AvalonDock/Controls/LayoutFloatingWindowControl.cs @@ -334,6 +334,7 @@ internal void AttachDrag(bool onActivated = true) } else { + CaptureMouse(); var windowHandle = new WindowInteropHelper(this).Handle; var lParam = new IntPtr(((int)Left & 0xFFFF) | ((int)Top << 16)); Win32Helper.SendMessage(windowHandle, Win32Helper.WM_NCLBUTTONDOWN, new IntPtr(Win32Helper.HT_CAPTION), lParam);