Hello, My name is Jesús from Spain, I'm a .NET developer and I just discovered this great web few days ago.
I have some questions about MVVM pattern and I will be glad if you can answer they.
I started WPF 3 months ago and I learned the MVP pattern. MVP is so good because you can structure the app so well.
I started seeing the mvvm pattern everywhere, but everyone is using the pattern by his own method. Every blogger is talking about MVVM in their WPF's blogs but every
implementation is distinct.
I'm focused now with the implementations that use the MVVM toolkit on codeplex, but I have questions and I don't find too much information.
I think that MVVM is a variation of MVP. With MVP every view has a presenter that do the view's job. In MVVM is the same thing but using Commands whenever you can. I saw
also that if you need and event, is like MVP, delegating the event to the presenter / viewmodel if it is not a view job (like updating the UI or something).
On the other hand, the ViewModel doesn't has a View reference so I have to play harder with databindings. You have to use the DelegateCommands (that are the same thing as
RelayCommands, right?).
Uhm... more questions... It's safe to use the same ViewModel with two views / usercontrols?
Oh... I ran into a problem yesterday when I was playing with MVVM pattern. I created a CommandReference of my command for the keybinding thing and I asigned this reference
to the command proprerty of my button, well, the CanExecuted worked the first time but it didn't update the IsEnabled property when the CanExecuted was true. I fixed it
binding the command directly to the button and not using the reference. The question is: Why some code is linking the reference to the objets and why other code is binding
the command directly?
What things related with MVVM should I learn? (I saw something called attached behaviors yesterday but I don't know what is that).
I'm rewriting a note tacking app that I developed using MVP but now with the mvvm (and the mvvm template). I will replace the events with commands (using the
DelegateCommand), eliminate the views references on the ViewModel and I think that's all because the examples that I saw of MVVM is much like MVP.
Well, I will apreciate if you point me to all the misunderstandings that I have with this pattern.
Thank you and in the future I will help the next MVVM novices :)