inputbinding

XAML - How to have global inputBindings?

最后都变了- 提交于 2019-11-27 20:55:28
I have a WPF application with several windows. I would like to define GLOBAL inputBindings. To define LOCAL inputbindings, i just declare the input in Window.InputBindings or UserControl.InputBindings. To define GLOBALs, I wish i could do the same with the Application class... <Application ....> <Application.InputBindings> ... </Application.InputBindings> If i have the same binding in 2 different windows, i have to code it twice. This doesn't meet D.R.Y.'s philosophy and i guess there is a better way... EDIT : in his answer Kent Boogaart advices me to use Style. Unfortunately, i can't figure

Defining InputBindings within a Style

左心房为你撑大大i 提交于 2019-11-27 17:34:17
问题 I'm creating a WPF app using the MVVM design pattern, and I'm trying to extend the TabItem control so that it closes the tab when the user clicks the middle mouse button. I'm trying to achieve this using InputBindings, and it works very well until I try to define it within a style. I've learned that you cannot add InputBindings to a style unless you attach it using a DependencyProperty. So I followed this similar post here... and it works... almost. I can close one tab using the middle mouse

InputBindings work only when focused

落爺英雄遲暮 提交于 2019-11-27 08:27:24
I have designed a reuseable usercontrol. It contains UserControl.InputBindings. It is quite simple as it only contains a label and a button (and new properties etc.) When I use the control in my window it works well. But the key binding only works when focussed. When one control has a binding to alt+f8 this shortcut only works when it is focussed. When the other one with its own binding is focussed, that one works but alt+f8 no more. When none of the controls has the focus, nothing works. How can I achieve that my usercontrol defines window-wide keybindings? Especially following MVVM design

XAML - How to have global inputBindings?

拈花ヽ惹草 提交于 2019-11-26 20:29:50
问题 I have a WPF application with several windows. I would like to define GLOBAL inputBindings. To define LOCAL inputbindings, i just declare the input in Window.InputBindings or UserControl.InputBindings. To define GLOBALs, I wish i could do the same with the Application class... <Application ....> <Application.InputBindings> ... </Application.InputBindings> If i have the same binding in 2 different windows, i have to code it twice. This doesn't meet D.R.Y.'s philosophy and i guess there is a

InputBindings work only when focused

只愿长相守 提交于 2019-11-26 17:45:00
问题 I have designed a reuseable usercontrol. It contains UserControl.InputBindings. It is quite simple as it only contains a label and a button (and new properties etc.) When I use the control in my window it works well. But the key binding only works when focussed. When one control has a binding to alt+f8 this shortcut only works when it is focussed. When the other one with its own binding is focussed, that one works but alt+f8 no more. When none of the controls has the focus, nothing works. How

KeyBinding in UserControl doesn&#39;t work when TextBox has the focus

旧街凉风 提交于 2019-11-26 07:35:46
问题 The following situation. I\'ve got a UserControl with five keybindings. When the TextBox has the focus the keybindings of the UserControl stop firing.. Is there a way to fix this \'problem\'? <UserControl.InputBindings> <KeyBinding Key=\"PageDown\" Modifiers=\"Control\" Command=\"{Binding NextCommand}\"></KeyBinding> <KeyBinding Key=\"PageUp\" Modifiers=\"Control\" Command=\"{Binding PreviousCommand}\"></KeyBinding> <KeyBinding Key=\"End\" Modifiers=\"Control\" Command=\"{Binding LastCommand}