We\'re just getting into MVVM in WPF.
We have implemented our ViewModels with \'strongly typed\' properties (int, double? etc.) that we bind to in the view.
Type
Or should ViewModel properties expose the actual data types, leaving such chores to the view to handle?
Conversion and templates are done in View
, because they both are just a conversion of values
, models
and viewmodels
into controls
! Controls
are available only inside View
.
Validation is done in ViewModel
, because validation is done according to business rules and can even be done through a call to a remote service. View knows nothing about business rules, but knows how to present validation results.
If, say, a non-numeric value is entered in a text box bound to a numeric property
A properly crafted numeric text box control never allows user to input a non-numeric value.