Skip to content

Commit

Permalink
Merge pull request #2133 from cwensley/curtis/wpf-fix-dialog-owner-crash
Browse files Browse the repository at this point in the history
Wpf: Fix calling Window.LostFocus when focus changes within a window
  • Loading branch information
cwensley committed Feb 1, 2022
2 parents 0efdb4b + a78469f commit a6bc368
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Eto.Wpf/Forms/WpfWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ public override void AttachEvent(string id)
Control.Activated += (sender, e) => Callback.OnGotFocus(Widget, EventArgs.Empty);
break;
case Eto.Forms.Control.LostFocusEvent:
Control.LostKeyboardFocus += (sender, e) => Callback.OnLostFocus(Widget, EventArgs.Empty);
// LostKeyboardFocus is called for every child, only fire event when the form is no longer active
Control.LostKeyboardFocus += (sender, e) => {
if (!Control.IsActive)
Callback.OnLostFocus(Widget, EventArgs.Empty);
};
break;
case Window.LocationChangedEvent:
Control.LocationChanged += (sender, e) => Callback.OnLocationChanged(Widget, EventArgs.Empty);
Expand Down

0 comments on commit a6bc368

Please sign in to comment.