What should go in each MVVM triad?
Posted
by Harry
on Stack Overflow
See other posts from Stack Overflow
or by Harry
Published on 2010-05-15T10:55:51Z
Indexed on
2010/05/15
11:04 UTC
Read the original article
Hit count: 254
OK, let's say I am creating a program that will list users contacts in a ListBox on the left side of the screen. When a user clicks on the contact, a bunch of messages or whatever appears in the main part of the window.
Now my question is: how should the MVVM triads look? I have two models: Contact, and Message. The Contact model contains a list of Message models.
Each ViewModel object will contain a single corresponding Model, right?
And what about the Views? I have a "MainView" that is the main window, that will have things like the menu, toolbar etc. Do I put the ListBox in the MainView? My confusion is with what to put where; for example, what should the ContactView contain? Just a single instance of a contact? So the DataTemplate, ControlTemplate, context menus, styles etc for that single contact, and then just have a ListBox of them in the MainView...?
Thanks.
© Stack Overflow or respective owner