SIGN UP MEMBER LOGIN:    
ARTICLE

Commands in WPF: Part III

Posted by Diptimaya Patra Articles | WPF with C# March 09, 2010
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.
Reader Level:
Download Files:
 

Introduction

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.

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.

image1.gif

image2.gif

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:


image3.gif


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.

image4.gif

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.

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Become a Sponsor