Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach (KeyBinding binding in InputBindings)
- {
- if (binding.Command == ApplicationCommands.Copy)
- {
- MessageBox.Show(binding.Modifiers.ToString() + " + " + binding.Key.ToString());
- }
- }
- Button b = new Button();
- b.Command = ApplicationCommands.Copy;
- List<string> gestures = new List<string>();
- if (b.Command is RoutedCommand)
- {
- RoutedCommand command = (b.Command as RoutedCommand);
- foreach (InputGesture gesture in command.InputGestures)
- {
- if (gesture is KeyGesture)
- gestures.Add((gesture as KeyGesture).DisplayString);
- }
- }
- <Button Command="ApplicationCommands.New" Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"></Button>
- <Window.InputBindings>
- <KeyBinding Key="C"
- Modifiers="Control"
- Command="ApplicationCommands.Copy" />
- </Window.InputBindings>
Add Comment
Please, Sign In to add comment