Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my main wpf project's page I defined an event binded with KeyGesture as follows:

C#
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

C#
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
Posted
Comments
[no name] 14-Mar-19 11:53am    
At some point you accept what is common, standard behavior.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900