Skip to content

Commit

Permalink
Merge pull request #376 from bbuerger/patch-3
Browse files Browse the repository at this point in the history
Prevents a known bug in WPF
  • Loading branch information
Dirkster99 authored Nov 4, 2022
2 parents 99b7e8d + dfa21a9 commit d0bbe39
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,26 @@ protected override void OnInitialized(EventArgs e)
base.OnInitialized(e);
}

protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
AssureOwnerIsNotMinimized();
}

/// <summary>
/// Prevents a known bug in WPF, which wronlgy minimizes the parent window, when closing this control
/// </summary>
private void AssureOwnerIsNotMinimized()
{
try
{
Owner?.Activate();
}
catch (Exception)
{
}
}

#endregion Overrides

#region Private Methods
Expand Down

0 comments on commit d0bbe39

Please sign in to comment.