Error templates
As we have discussed previously, we can notify the user of the error condition by highlighting the particular field that failed the validation in the view. By default, the element is highlighted with a red border. We can update this behavior by overriding the error template. Let's revisit the example in the previous chapter to demonstrate error templates. In that example, we had a simple order entry form where the user could submit an order by specifying a customer, a product, and its quantity. Let's now update OrderViewModel
, as follows:
namespace MVVMApp_WFBasedBusinessRules.ViewModel { using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using MVVMApp_WFBasedBusinessRules.Model; class OrderViewModel : ViewModelBase { #region Constructors public OrderViewModel() { _model.PropertyChanged += new System.ComponentModel .PropertyChangedEventHandler( _model_PropertyChanged); } #endregion Constructors...