What is the Difference between the Delegate Command and Routed Command?
I read some article that says use Delegate Command on MVVM instead of Routed Command.
So What are the advantages of Delegate Command over Routed Command when we use MVVM?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Some advantages of using a DelegateCommand (a.k.a. RelayCommand) are:
1) Requires less XAML/code to support them (don’t need CommandBindings)
2) Command implementation code can easily be written in ViewModel classes
3) They do not take a dependency on the UI element tree to work properly, which also helps improve performance
Since a lot of third-party UI controls use routed commands, most developers end up using routed commands when taking a dependency on those controls.
If you end up needing to use routed commands, check out my Using RoutedCommands with a ViewModel in WPF article to see a way to simplify things.