Skip to content

Commit

Permalink
handle key down/up events at TopLevel
Browse files Browse the repository at this point in the history
fixes a bug where lost focus (for a variety of reasons) would prevent the key event handlers from firing
  • Loading branch information
Raymonf committed Oct 21, 2023
1 parent 90c1d84 commit 162a34b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions BAKKA_Editor/Views/MainView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ public MainView()
DataContext ??= new MainViewModel();
InitializeComponent();
Setup();
AddHandler(KeyDownEvent, OnPreviewKeyDown, RoutingStrategies.Tunnel);
AddHandler(KeyUpEvent, OnPreviewKeyUp, RoutingStrategies.Tunnel);
KeyDownEvent.AddClassHandler<TopLevel>(OnPreviewKeyDown, RoutingStrategies.Tunnel, handledEventsToo: true);
KeyUpEvent.AddClassHandler<TopLevel>(OnPreviewKeyUp, RoutingStrategies.Tunnel, handledEventsToo: true);
}

private static bool IsDesktop => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ||
Expand Down

0 comments on commit 162a34b

Please sign in to comment.