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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With