Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I m implementing M-V-VM pattern in my WPF application. As far as designing ViewModel class is concerned I wanted to know when to use DelegateCommand and when to use RelayCommand to expose inline operations through Command.

or are they 100% interchangable? Is there any scenatrio where one is preferred over other?

Thanks
Posted

You are not the first one wondering about this. There is some discussion going on about this with the basic conclusion that RelayCommand is more lightweight and based on your needs you choose the one that is best suited at a given point. Have a look at these links for more info.

http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=63174[^]

http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=63174[^]

http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb/[^]

Good luck!
 
Share this answer
 
Comments
Kamal Gurnani 14-Jan-11 7:58am    
Thanks for above links.
Here is a thorough article from MSDN
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx[^]

This may also be of interest:
DelegateCommand vs RoutedCommand vs EventHandler
[^]

Regards
Espen Harlinn
 
Share this answer
 
Comments
Kamal Gurnani 14-Jan-11 7:57am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900