If my domain objects implement IDataErrorInfo, and I am using M-V-VM, how do I propagate errors through the ViewModel into the View? If i was binding directly to the model, I would set the "ValidateOnExceptons" and "ValidateOnErrors" properties to true on my binding. But my ViewModel doesn't implement IDataErrorInfo. Only my model. What do I do?
Clarification I am dealing with an existing codebase that implements IDataErrorInfo in the domain objects. I can't just implement IDataErrorInfo in the my view model.
The BookLibrary sample application of the WPF Application Framework (WAF) might be interesting for you. It implements the IDataErrorInfo interface as well on the domain objects and it uses the M-V-VM pattern.
There is a good MSDN Magazine article on this topic, WPF Apps With The Model-View-ViewModel Design Pattern: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
According to this article, in The Data Model and Repository section (http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090102) you will find a simple implementation. The Customer is the entity class and the ViewModel gets the error indicators from the entity.
You can use ValidationsRule to check data validity:
This is an example of validator styling:
if you are using M-V-VM, the ViewModel should define the IDataErrorInfo interface, not the model.
You could say that the IDataErrorInfo interface is just for the view and it doesn't belong in the model, but that's a question of style.
Having the ViewModel implement the IDataErrorInfo interface and propagate the errors from the model would be the simplest answer.
You can implement IDataErrorInfo additionally in your VM and route the calls to the VM to your corresponding domain objects. I think this is the only way without exposing domain objects directly to the view.