I have some questions about the MVVM pattern

My name is Jesus from Spain, I am a .NET developer, and a few days ago I opened this wonderful network.

I have some questions about the MVVM template, and I will be glad if you can answer them.
I started using WPF three months ago and I recognized the MVP pattern.
MVP is so good that you can structure your application so well.

I started to see MVVM everywhere, but everyone uses the template with their own method.
Every blogger talks about MVVM on their WPF blogs, but each implementation is different.

Now I'm focused on implementations that use the MVVM toolkit for CodePlex, but I have questions and I can not find too much information.

I think MVVM is a variation of MVP.
With MVP, there is a presenter in each view that performs the view task.
In MVVM, this is the same thing, but using commands whenever you can.

I also saw that if you need an event, you like it with MVP; delegating the event to the host / View -Model, that is, if it is not a task for the presentation (for example, updating the user interface).

On the other hand, the View-Model does not have a View link, so I have to play more with data binding.
You should use DelegateCommands (this is the same as RelayCommands, right?).

Uhm ... more questions ... Is it safe to use the same View model with two views / user controls?

... , MVVM.
CommandReference , , , CanExecuted , IsEnabled, CanExecuted . , . : - ?

MVVM? ( -, , , ).

, MVP, MVVM. ( DelegateCommand), View , , , MVVM, MVP.

, , , .

, MVVM:)

+3
2

, , , ... , ( )

  • MVVM MVP. MVP , . . MVVM , MVP. , -. , MVVM , MVP, ( ). , MVP .
    • - .
    • - MVVM Supervising Controller, . , MVVM ( "View Model" )
  • ViewModel , . . , , . , ViewModel . - ( -) .
  • DelegateCommands vs. RelayCommands - , , , .
  • ViewModel . , , , ViewModels . . -, ViewModel, ViewModel .
  • , , ViewModel 1:1 UserControl, UserControls .
  • , , , . , , , , " " . .

, , MVVM , WPF, . , , . , MVVM , , , , .

( ), WPF , . , . "", .

@micahtan , , WPF. , WPF MVVM-, , MVVM , , .

+12

RelayCommand. , , ICommand . SoapBox Core ICommandControl ViewModels .., . AbstractCommandControl , .

+1

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


All Articles