From da3dc87ed36f19e1783d5e041519f2297ee6a757 Mon Sep 17 00:00:00 2001 From: Ano-sys Date: Sun, 23 Mar 2025 00:24:06 +0100 Subject: [PATCH] Added Global KeyUp Event which is passed to ViewModel --- Views/MainWindow.axaml.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Views/MainWindow.axaml.cs b/Views/MainWindow.axaml.cs index 0a86ffe..cef621d 100644 --- a/Views/MainWindow.axaml.cs +++ b/Views/MainWindow.axaml.cs @@ -19,6 +19,16 @@ public partial class MainWindow : Window DataContext = new MainWindowViewModel(); Topmost = true; Topmost = false; + + this.KeyUp += OnKeyUp; + } + + private void OnKeyUp(object? sender, KeyEventArgs e) + { + if (DataContext is MainWindowViewModel vm) + { + vm.GlobalKeyUpHandler(e); + } } // MVVM like implementations burst the bounds -> implemented the old school way