Standard View Model - hard coded items

Jun 2, 2015 at 3:06 AM
I am new to your framework and was surprised to see hard coded explicit items in StandardViewModel.cs . For example, Text1 to 10, Image1 to 5, etc. The one that particularly worries me is Number1 and Number2. So is the Standard View Model is restricted to only two numeric fields (that are of type string) ? Why not just accept a Lists of the proper type ? Was this a limitation imposed by your service layer or the exposure of the interface so that the notifies work properly in WPF ?
Coordinator
Jun 3, 2015 at 3:40 AM
Eric,

this is by design. The StandardViewModel class is specifically created to provide a few standard fields (text, numeric, image,...). So it makes it easy to create a simple UI (often for lists) where one may just need a few text fields or a few text fields and a numeric field and an icon or such. Which is not uncommon.

However, note that this is somewhat of a special case. If many cases, you would create your own view-model and not use these fields. In that case, you can either create your own view-model from scratch, or inherit from our ViewModel class, which is a generic view-model that provides some convenience features (such as change notification) but no implemented properties of any kind.

For a more detailed discussion of the special-case topic of standard-view-models, check out this article: http://www.codemag.com/Article/1301041


Markus