Using IDataErrorInfo and setting Validation.HasError style

Posted by Gaurav on Stack Overflow See other posts from Stack Overflow or by Gaurav
Published on 2009-07-17T11:20:49Z Indexed on 2012/11/14 17:01 UTC
Read the original article Hit count: 424

Filed under:
|
|

In WPF using IDataErrorInfo and Style I want to create form where I can provide end user three different status while validating data To make the scenario more clear

1) I have textbox next to it I have icon which provides end user what kind of input textbox expects - Initial status with information icon

2) As soon as user enter data it validates it and decides whether it is valid or not - most of the time it will show cross (X) icon saying invalid data

3) As it is validating on UpdateSourceTrigger="PropertyChanged" it will turn cross icon to green check mark as soon as it gets validated

i.e

[         ] i (tooltip- Any valid user name )
[Ga       ] X (tooltip- Invalid user name. Must be 5 char long)
[Gaurav   ] * (it will show only correct icon, meaning valid value)

How can I achieve this using IDataErrorInfo and Style, I tried doing that but as soon as my form gets loaded it invalidates all the data and shows cross icon at the first time. I want to show different tooltip and different icon for three states (Initial info, Invalid data, Valid data)

© Stack Overflow or respective owner

Related posts about wpf

Related posts about validation