Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF
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 6-Sep-12 2:11am
Edited 6-Sep-12 2:12am
v2

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

  Print Answers RSS
0 Mathew Soji 334
1 Maciej Los 295
2 BillWoodruff 290
3 Afzaal Ahmad Zeeshan 257
4 DamithSL 225
0 OriginalGriff 6,369
1 Sergey Alexandrovich Kryukov 5,973
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,045


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 6 Sep 2012
Copyright © CodeProject, 1999-2014
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