I'm currently working on a Silverlight app using Caliburn.Micro.
At present, we have Views (eg: PeopleView) and View Models (eg: PeopleViewModel) that equate to 'pages' of the application.
PeopleView might contain a ListBox ("People") which is bound to an ObservableCollection of Person objects, and has an ItemTemplate assigned to denote how each Person object should be displayed.
However, one of my colleagues has begun to implement a list in another way, where each Person is a View Model (ie: PersonViewModel) and has an associated PersonView to determine how that PersonViewModel should be displayed in the ListBox.
The latter seems more MVVM (or at least has more mention of V and VM!) but I'm not sure whether there's a particularly large advantage to doing one over the other.
Are both of these ways valid? Is either better than the other?
AgeGroupColourin this scenario sounds to me more like something that should be defined in the View, as it's purely cosmetic. Although it's restricted to two states, I've generally usedDataStateBehaviorto achieve this in the item's DataTemplate based on model properties, and I think this type of idea could be extended in this way, although I could be wrong! – Town Sep 07 '11 at 14:51ViewModelis a testable representation of theView, you might have a unit test which cares thatAgeGroup.Teenis displayed asColors.Redso you'd want it in theViewModel. In my opinion, you want as little "logic" in theViewas possible. – Scott Whitlock Sep 07 '11 at 14:57