Welcome to Windows Presentation Foundation (WPF)
Top Tasks :

WPF Community Bloggers

The Delegating Command

The RoutedCommand doesn't quite make sense to me in the M-V-VM pattern. Why go through the effort of creating command bindings when you are holding an instance of the Command within your controller (or ViewModel). Just trust me when I say it's convoluted. At the other extreme, you would have to create a new class for each and every Command that your application provides. While there is a benefit to this scenario in some cases, in most instances it's overkill. A happy medium is having a class that implements ICommand and exposes events for CanExecute and Execute. Hence I give you the DelegatingCommand. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Input; namespace YourNamespaceHere { /// <summary> /// Delegate for adding logic for determining if a /// <see cref="DelegatingCommand"/> can be executed /// </summary> /// <param name="parameter"> /// The parameter being passed to the command Read More...
Published Tuesday, October 16, 2007 4:25 PM by Brownie Points
Filed under:

Comments

No Comments
Anonymous comments are disabled

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us