Click here to Skip to main content
12,999,417 members (55,895 online)
Rate this:
Please Sign up or sign in to vote.
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?

Posted 6-Sep-12 1:11am
Updated 6-Sep-12 1:12am

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170624.1 | Last Updated 6 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100