diff --git a/src/Libraries/AvalonDock/AvalonDock/ManagedContent.cs b/src/Libraries/AvalonDock/AvalonDock/ManagedContent.cs index 1259179fe0..501ac136bd 100644 --- a/src/Libraries/AvalonDock/AvalonDock/ManagedContent.cs +++ b/src/Libraries/AvalonDock/AvalonDock/ManagedContent.cs @@ -337,7 +337,9 @@ namespace AvalonDock protected virtual void OnDragMouseLeave(object sender, MouseEventArgs e) { - if (!e.Handled && isMouseDown && e.LeftButton == MouseButtonState.Pressed && Manager != null) + // The MouseLeave event can occur if the managed content was closed while the user held the left mouse button pressed. + // In that case, this.IsLoaded will be false and we won't handle the event + if (!e.Handled && isMouseDown && e.LeftButton == MouseButtonState.Pressed && Manager != null && this.IsLoaded) { if (!IsMouseCaptured) {