Keep your Output window squeaky clean in the face of validation errors

6 views
Skip to first unread message

Josh Smith

unread,
Oct 8, 2008, 9:48:50 AM10/8/08
to wpf-di...@googlegroups.com
If you've ever worked with the MS-recommended approach for displaying validation errors and detested how much garbage it produces in Visual Studio's Output window, then my latest post is for you:

http://joshsmithonwpf.wordpress.com/2008/10/08/binding-to-validationerrors0-without-creating-debug-spew/

Josh

Karl Shifflett

unread,
Oct 8, 2008, 10:00:03 AM10/8/08
to wpf-di...@googlegroups.com
Mr. WPF,

Very nice post.

I've always disliked the practice of binding to element (0). What if there were two exceptions? So I use a converter to by-pass the error you speak of and
function concat() {
[native code]
}
all exceptions into one single message.

LOVE WPF!

k-dawg

________________________________

winmail.dat

Josh Smith

unread,
Oct 8, 2008, 10:01:06 AM10/8/08
to wpf-di...@googlegroups.com
As far as I know, WPF does not support having multiple validation errors in the Validation.Errors collection.  It's either empty, or has one error in it. 

Josh

Karl Shifflett

unread,
Oct 8, 2008, 10:09:21 AM10/8/08
to wpf-di...@googlegroups.com
Good point. That is what I figured. I guess they used a collection for a future feature; so I wrote my code so that it would not break JUST incase two of them roaches snuck inside the collection.
winmail.dat

Josh Smith

unread,
Oct 8, 2008, 10:08:59 AM10/8/08
to wpf-di...@googlegroups.com
Yeah that makes sense.  I was thinking about adding in an ItemsControl to display all of Validation.Errors, but decided not to obfuscate my example.

Karl Shifflett

unread,
Oct 8, 2008, 10:14:39 AM10/8/08
to wpf-di...@googlegroups.com
Your example is FANTASTIC and only further demonstrates your full and awesome understanding of WPF.
winmail.dat

Josh Smith

unread,
Oct 8, 2008, 10:12:46 AM10/8/08
to wpf-di...@googlegroups.com
Thanks dude!
Reply all
Reply to author
Forward
0 new messages