.NET 3.5 shipped a few months ago. There are a number of improvements that apply to WPF applications. Today I want to talk about the Binding class improvements.
Some good news on the performance front. The WPF and ADO.NET team have spent considerable resources improving the data-binding performance. More details in future posts.
In .NET 3.0 you turn on Validation for a bound element by add in a ExceptionValidationRule to the Binding.ValidationRules property element. As you can see in the following example the XAML gets a bit wordy.
In .NET 3.5 you can use this simpler property attribute syntax.
IDataErrorInfo and the Binding class
The data-binding engine in WPF is a suburb first release. The underlying framework is well designed and very extensible. Like any first release though there are rough spots.
One issue is with 3.0 is in how data validation is performed. Most of the time you want your business class to perform the validation. That way, any client (including UI clients) can use the class and you are ensured consistent validation. The last thing you want to have is any validation rules in your UI layer.
In 3.5 you can retrieve the error from IDataErrorInfo in your business class. The simplest XAML you can write for listening to these errors is below.