Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
<Window.InputBindings>
<KeyBinding Key="0" Command="{Binding ZeroCommand}"/>
<KeyBinding Key="1" Command="{Binding OneCommand}"/>
<KeyBinding Key="2" Command="{Binding TwoCommand}"/>
<KeyBinding Key="3" Command="{Binding ThreeCommand}"/>
<KeyBinding Key="4" Command="{Binding FourCommand}"/>
<KeyBinding Key="5" Command="{Binding FiveCommand}"/>
<KeyBinding Key="6" Command="{Binding SixCommand}"/>
<KeyBinding Key="7" Command="{Binding SevenCommand}"/>
<KeyBinding Key="8" Command="{Binding EightCommand}"/>
<KeyBinding Key="9" Command="{Binding NienCommand}"/>
<KeyBinding Key="OemPlus" Command="{Binding PlusCommand}"/>
<KeyBinding Key="OemMinus" Command="{Binding MinusCommand}"/>
<KeyBinding Key="OemBackslash" Command="{Binding DevideCommand}"/>
<KeyBinding Key="Multiply" Command="{Binding MultiplyCommand}"/>
<KeyBinding Key="Return" Command="{Binding EqualsCommand}"/>
</Window.InputBindings>
I was creating a basic calculator app when I ran into this issue. I am getting a compilation error '0' can not be used as a value for 'Key'. Numbers are not valid enumeration values. In fact OemMinus is the only command that is being bound.
I think could fix this by creating a InputBindingConfiguration class with a singleton, define the keys there and bind to those keys but I was wondering if there was a way of doing this purely in Xaml ?
–
–
A - Z The basic letter keys.
D0 - D9 The numeric keys from the main section of the keyboard.
Space The space bar.
F1 - F24 The function keys.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.