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 { ...

Get MVVM Survival Guide for Enterprise Architectures in Silverlight and WPF now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.