Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
BRH 48
#DOTNET 34
#ASP.NET 29
jQuery 22
ASP.NET 20
.NET 20
WPF 9
jquery interview questions 9
jquery faq 8
ASP.NET4 8

Archive · View All
February 2011 10
September 2011 4
August 2011 4
July 2011 4
May 2011 4
April 2011 4
March 2011 4
October 2011 4
June 2011 4
January 2011 4

What are WPF Commands and Events

Sep 16 2011 8:13PM by Hima   

In order the application to respond to user input WPF offers 2 concepts . Lot of people get confused with events and commands.  When do you use what?

When to choose which?

Handling input in WPF  is done by

1. Event Handling 

2. Command Handling

Events

  • Events represent low level interactions.
  • Events are faster than commands. To learn more about types of events and how WPF events are handled Please go through the previous post

Commands

  • Commands respond to actions. Commands represents high level input interactions like print, copy, paste, Which commands are associated to which action.
  • Commands can be called from Menu item, Toolbar button, Keyboard, etc. Commands are more standard way to integrate Events.

Advantages of Commands

  • Commands do not link to the caller, so commands are is not dependent  .
  • A command can tell us if an action is possible or not. This can be done by  implementing the CanExecute method. A button can attach CanExecuteChanged event and will be disabled if CanExecute returns false. The same button can be enabled if CanExecute returns true. So Commands provide support for enabling/disabling all related UI controls based on this status of command.

Its best practice to use commands over events at real project, especially if you  use MVVM design pattern.

In the next post we will examine how to implement and handle commands in WPF

Tags: .NET, #DOTNET, #ASP.NET, ASP.NET, WPF, Events Vs Commands in WPF, Commands, Events,


Hima
31 · 6% · 1776
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

1  Comments  

  • Can you please explain any specific reason why MS introduce event Bubbling.

    commented on Oct 4 2011 10:01AM
    Parth A.Trivedi
    3082 · 0% · 2

Your Comment


Sign Up or Login to post a comment.

"What are WPF Commands and Events" rated 5 out of 5 by 1 readers
What are WPF Commands and Events , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]