In my main wpf project's page I defined an event binded with KeyGesture as follows:
KeyBinding b = new KeyBinding()
{
Command = SpvCommands.ChangeUser,
Gesture = new KeyGesture((Key.A), (ModifierKeys.Control | ModifierKeys.Shift))
};
InputBindings.Add(b);
Now, the user can open a UnitConsole object which is a Window object
UnitConsole cons = new UnitConsole(UnitModel);
cons.Width = (UnitModel.ConsoleWidth > 0) ? UnitModel.ConsoleWidth : 410;
cons.Height = UnitModel.ConsoleHeight > 0 ? UnitModel.ConsoleHeight : 380;
cons.MinWidth = 200;
cons.MinHeight = 200;
cons.ResizeMode = ResizeMode.CanResizeWithGrip;
cons.Background = new SolidColorBrush(Color.FromRgb(50, 50, 50));
cons.WindowStartupLocation = WindowStartupLocation.CenterScreen;
cons.WindowStyle = WindowStyle.None;
cons.Style = this.Resources["WindowBaseStyleToolBox"] as Style;
cons.BorderThickness = new Thickness(0);
cons.Owner = Application.Current.MainWindow;
cons.Show();
Basically when this object is raised, the focus is on it, so I'm not able to use the Ctrl+Shift+A combination as I'm not on parent.
I would like to be able to raise the SpvCommands.ChangeUser event also If I'm on a console. Is there a way, a kind of bubble event, to handle this?
What I have tried:
I tryied to use a
RoutedEvent
but as I'm a beginner I dunno how to handle it correctly