Handling and Reporting WPF Data Binding Validation Errors and Exceptions

3 04 2008

This last month Karl has been obsessed with WPF business object data binding, and the .NET 3.5 support for the IDataErrorInfo interface.

He posted an informative article entitled Handling and Reporting WPF Data Binding Validation Errors and Exceptions.

This article, which includes a Silverlight video, challenges the reader to fully understand what messages the WPF data binding pipeline routes to the UI and how to report/handle exceptions thrown during the data binding process. It includes a demo application that throws exceptions at different locations in the source object and how to create robust code that can deal with them gracefully.

A custom value converter and Validation.ErrorTemplate combine to provide a developer with the capability to display inner exception messages should they be routed to the UI. Additionally, this article explains why using a trigger to set a ToolTip for displaying an error message may not be a good practice.