Reputation: 4948
I had been developping using WinForms for about a year now and I recently started discovering WPF. I have been more and more interested in this concept and started looking into the WPF's Framework MVVM.
I've looked at a lot of documentation on MSDN and some videos on YouTube trying to explain this.
If I understand correctly, the Models are basically the structure of your object (for example, Customers) and the ViewModels is what can work WITH the Customers object. Therefore I would bind my Window's DataContext to my ViewModel?
Upvotes: 1
Views: 95
Reputation: 13377
Did you read the MVVM article from MSDN mag? I'm guessing yes, since you're mentioning customers... msdn.microsoft.com/en-us/magazine/dd419663.aspx
If you've been coding OOP in winforms, then you've got classes to represent your data. That's nearly a 1:1 for what a model is. As a super-simplified way of looking at a viewmodel, think of it as the code that previously went into your code-behind for the controls of the page. It tells the view how to draw itself.. buttons to show/enable and the like.
So, in summary,
model::data as viewmodel::form_controls
Upvotes: 2