Tuesday, January 31, 2012
Commanding inis unlike your traditional events in WinForms. Commands were primarily designed to be used at the application level, but they have become one of the most popular features among developers when it comes to UI programming (we tend to use them more than they should be). Commands enable the developer to define a task once and “attach” it multiple times without having to go through the traditional means which would require duplicating the code or even calling it in more than one place. (This is the magic.) intrinsically provides five commands that you can use out of the box.
I have explored them and have taken a liking to
ApplicationCommands. (In fact this is the one that most developers will use.)
To use the command, do the following:
- Link your custom/predefined command to a control that you want to respond to the command and add an input gesture to the command.
- Create a handler for the command and use the
CommandBindingsclass to bind the handler to the control.
- Add the binding to the control’s Commands collection.
So let’s delve into some code to demonstratecommanding.
“The Windows Presentation Foundation is Microsofts next generation UI framework to create applications with a rich user interface.”
Before the release of WPF, UI developers used to concentrate on various services or API to develop desktop applications to produce simple application to high end graphic application. So it was highly necessary for any developer to concentrate on one or more services or API for building high end graphics.
Developers used to concentrate on many API’s to achieve desired functionality and make UI more attracitve
Forms Dialog boxes ,controls — VB6 MFC
2D Graphics System.Drawing.dll
3D Graphics DirectX
Streaming Video Windows Media Player API
FLow/Mixes Documents PDFs API
In WPF all these is achieved with only Windows Presentation Foundation Framework