In Part II of this article series we have seen the concepts of Commands and we experienced Command Binding feature. In this article we will see how Input Binding is helpful.
IntroductionIn Part II of this article series we have seen the concepts of Commands and we experienced Command Binding feature. In this article we will see how Input Binding is helpful.As we discussed in our last article InputBinding is an association between a particular input and command.We will modify our Application such that without Button Click how we can call the Properties Command.So our UI will contain only the TextBox control, we would get rid of the Button that we used in our previous sample.As you see above we have only a TextBox control that doesn't have any Commands associated.Now in Code behind retain the CommandBinding. We have to just create an InputBinding object with the proper Command and KeyGestures. Follow the below code:As you see above we have created the InputBinding object with ALT+ENTER as the KeyGesture.Now let's run the application and see by pressing the above key combination what happens.And we have the Command successfully running on KeyGesture.Now we can have key combination of our choice and it will handle the Properties Command.Hope this article helps, understanding InputBinding.
WPF Simplified: Build Windows Apps Using C# and XAML