Browse Source

[AvalonDock] Fix "InvalidOperationException: This Visual is not connected to a PresentationSource" when closing a view content by middle-clicking while holding the left mouse button.

pull/28/head
Daniel Grunwald 13 years ago
parent
commit
6d39f5965b
  1. 4
      src/Libraries/AvalonDock/AvalonDock/ManagedContent.cs

4
src/Libraries/AvalonDock/AvalonDock/ManagedContent.cs

@ -337,7 +337,9 @@ namespace AvalonDock
protected virtual void OnDragMouseLeave(object sender, MouseEventArgs e) 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) if (!IsMouseCaptured)
{ {

Loading…
Cancel
Save