.NET 3.5 is rapidly approaching.
Sometime late this year, if everything goes as planned, NET 3.5 will be finished. There is a handful of big changes in the next release that will have a major impact on writing .NET code. Of these I’d have to place LINQ at the head of the queue. But as is always the case with new releases from Microsoft there are little changes that don’t get a lot of press but turn out to be really useful.
WPF 3.0 shipped without an ErrorProvider control. There was a mechanism for showing errors in the UI (write a custom ValidationRule class or use the lame ExceptionValidationRule class) but they weren’t very satisfying.
.NET 2.0 had the wonderful IDataErrorInfo interface. This was used by the WinForms binding engine and was useful for creating business classes that could notify the UI in times of trouble.
In .NET 3.5 we get to use IDataErrorInfo interface with WPF binding. What’s that noise you hear? It’s the happy sound of middle tier developer everywhere applauding this feature. Seriously, this is great news.
Below is a simple class that implements IDataErrorInfo.
Validating in XAML
Here’s a quick way to bind to the Product class.
Update October 11. 2007
Rocky Lhotka has this to say about the new IDataErrorInfo binding.
A couple people have emailed me, asking what I think about this. My answer: I’m happy as can be!