File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
source/Components/Xceed.Wpf.AvalonDock Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ public class LayoutAnchorableTabItem : Control
28
28
29
29
private bool _isMouseDown = false ;
30
30
private static LayoutAnchorableTabItem _draggingItem = null ;
31
+ private static bool _cancelMouseLeave = false ;
31
32
32
33
#endregion
33
34
@@ -146,6 +147,10 @@ protected override void OnMouseMove( System.Windows.Input.MouseEventArgs e )
146
147
_isMouseDown = false ;
147
148
_draggingItem = null ;
148
149
}
150
+ else
151
+ {
152
+ _cancelMouseLeave = false ;
153
+ }
149
154
}
150
155
151
156
protected override void OnMouseLeftButtonUp ( System . Windows . Input . MouseButtonEventArgs e )
@@ -163,10 +168,13 @@ protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e )
163
168
164
169
if ( _isMouseDown && e . LeftButton == MouseButtonState . Pressed )
165
170
{
166
- _draggingItem = this ;
171
+ // drag the item if the mouse leave is not canceled.
172
+ // Mouse leave should be canceled when selecting a new tab to prevent automatic undock when Panel size is Auto.
173
+ _draggingItem = ! _cancelMouseLeave ? this : null ;
167
174
}
168
175
169
176
_isMouseDown = false ;
177
+ _cancelMouseLeave = false ;
170
178
}
171
179
172
180
protected override void OnMouseEnter ( MouseEventArgs e )
@@ -215,6 +223,11 @@ internal static void ResetDraggingItem()
215
223
_draggingItem = null ;
216
224
}
217
225
226
+ internal static void CancelMouseLeave ( )
227
+ {
228
+ _cancelMouseLeave = true ;
229
+ }
230
+
218
231
#endregion
219
232
}
220
233
}
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ This program is provided to you under the terms of the Microsoft Public
22
22
using System . Globalization ;
23
23
using System . Windows . Media ;
24
24
using System . ComponentModel ;
25
-
25
+ using Xceed . Wpf . AvalonDock . Controls ;
26
26
27
27
namespace Xceed . Wpf . AvalonDock . Layout
28
28
{
@@ -159,6 +159,7 @@ public bool IsSelected
159
159
parentSelector . SelectedContentIndex = _isSelected ? parentSelector . IndexOf ( this ) : - 1 ;
160
160
OnIsSelectedChanged ( oldValue , value ) ;
161
161
RaisePropertyChanged ( "IsSelected" ) ;
162
+ LayoutAnchorableTabItem . CancelMouseLeave ( ) ;
162
163
}
163
164
}
164
165
}
You can’t perform that action at this time.
0 commit comments