I used to use IDataErrorInfo
in my MVVM/WPF applications. Now after INotifyDataErrorInfo
is available in .Net 4.5 is it better to replace IDataErrorInfo
or continue the old way using IDataErrorInfo
?
There are a number of improvements in INotifyDataErrorInfo
(in particular, it's support for multiple, dynamically changing error messages per object/property) that make it superior to the previous interface. But the biggest difference is that it's asynchronous. You now have to fire the ErrorsChanged
event whenever the error state changes.
If you are implementing an application in .NET 4.5 that targets devices running Windows 8, you should strongly consider using the new interface. Asynchronous-style programming is the "intended model" for such applications, particularly if you include RT-devices. It's not that much more complex to implement INotifyDataErrorInfo
over IDataErrorInfo
, so there's not really a downside.
That doesn't mean you should go retrofit all your existing applications, though; again, it depends on your target. If you're trying to upgrade an existing application to be RT-compatible, you should probably swap in the new error handling code. Otherwise, no need to change what works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With