Click here to Skip to main content
15,896,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm seeing some weird behavior with the Validation.Error attached event. I have a textbox bound to an object that implements the IDataErrorInfo interface. The textbox subscribes to the Validation.Error event. What is weird is that when you put the text box into an invalid state, the Validation.Error event gets triggered twice. Under .NET 3.5, the first time ValidationErrorEventArgs.Action == Removed. The second time ValidationErrorEventArgs.Action == Added. Under .NET 4, it's reversed. The first time ValidationErrorEventArgs.Action == Added. The second time ValidationErrorEventArgs.Action == Removed.

When textbox has "bad data" TextBox by hand (tabbing or mouse does not matter) and changing something in the TextBox that is still "bad data" and tabbing away triggers validation routines properly. The problem : event Validation.Error="DatBoxError" is fired twice: first with Action=Added and secondly immediatly after the first call with Action=Removed. So the text in the Tooltip is gone. This is unexpected because the first call has been handled properly and Action=Removed should only be called when validation is OK.

All my validation get failed as our project moves from 3.5 framework to 4.0.

Has anyone come across this issue, or is there something wrong in my code?

Thanks,
Preeti
Posted
Updated 6-Sep-12 1:12am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900