ho risolto.
quello che mi serviva era chiudere il programma con Ctrl+Q.
ho fatto cosi:
codice:
<Window x:Class="B2B.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="B2B" Height="800" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
<Window.InputBindings>
<KeyBinding Modifiers="Control" Key="Q" Command="{Binding exitCmd}" />
</Window.InputBindings>
..........................
</Window>
poi nella corrispettiva classe:
codice:
public MainWindow()
{
InitializeComponent();
AddKeys();
}
private void AddKeys()
{
RoutedCommand exitCmd = new RoutedCommand();
exitCmd.InputGestures.Add(new KeyGesture(Key.Q, ModifierKeys.Control));
CommandBindings.Add(new CommandBinding(exitCmd, ExitHandler));
}
private void ExitHandler(object sender, ExecutedRoutedEventArgs e)
{
this.Close();
}
ciao!