Is DelegateCommand the same as "Attached Behavior"?

I used the DelegateCommand found in MVVM Visual Studio in CodePlex. This one works very well so that views can execute commands on their ViewModel.

I read somewhere that MVVM should use attached behavior . ”As far as I can tell,β€œ attached behavior ”is the same type of template as DelegateCommand, but it uses Silverlight because it has no commands.

Is this the right one ? Or is it "attached behavior", something else in kind and worthy of study in the DelegateCommand case?

+3
source share
1 answer

The DelegateCommand command (or RelayCommand, which is almost the same but accepts a parameter) is just a lightweight implementation of the ICommand interface that allows the ViewModel to easily output commands.

Attached behavior is a way to associate an event with a team. For example, most WPF controls do not have the Command property, so you usually cannot define a command to respond to their events. With attached behavior, you can "bind" any event of any control to the command of your ViewModel. Check out the performance of Marlon Grech , which seems to me the most flexible

+6

Source: https://habr.com/ru/post/1709365/


All Articles