Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are RelayCommand or DelegateCommand not part of WPF? [closed]

The Model-View-ViewModel (MVVM) approach seem to be the front-runner pattern in WPF UI development. Almost every article I read implies that it is the best-practice. Usage of RelayCommand or DelegateCommand is also prominent in many articles and it seems like it is almost impossible to implement MVVM without using either of them (or any other variations). So why aren't they part of .NET 4?

I know that RelayCommand is really simple to implement and a lot of third party toolkits already have it but I'm just wondering why Microsoft would leave out something so basic and fundamental to the implementation of a so-called "best practice"?

like image 662
Patricia Coelho Avatar asked Jun 24 '11 14:06

Patricia Coelho


2 Answers

Because Microsoft takes care of WPF, and not of MVVM.

If you want a full toolkit containing all components needed for a good MVVM application, I encourage you to take a look at Prism : A good tutorial here

The basic reason is that Microsoft is focusing on "mainstream" WPF functionalities (like enhancing Controls and Bindings). MVVM is, if I am right, "supervised" by the MVVM foundation.

like image 199
Damascus Avatar answered Oct 20 '22 15:10

Damascus


As with most things it comes down to money. It may be a simple class, but including it in .NET requires a lot of work. A single class must be:

  1. Fully tested before release. Regression tests must be implemented for future versions as well.
  2. Fully documented in several languages, which must also be verified.
  3. It would have to be renamed, since using RelayCommand or DelegateCommand would most likely break any WPF out there that already has these classes, as there would be naming conflicts.

Each of these requires more work than you'd expect also (i.e. #2 would have first drafts, revisions, final approval, etc).

Found a relevant link here.

like image 32
CodeNaked Avatar answered Oct 20 '22 14:10

CodeNaked