WPF Reflections

May 25 2008   10:03PM GMT

WPF DataTriggers with enums

Mark Shurmer Profile: MarkWPF

This is something that I had to do recently, and it wasn’t as obvious as I thought.

Given a very simple enum like:

blog25may2008.JPG

The first (and obvious) try is:

blog-25may2008-3.JPG

Here we are trying to hide a label and a textbox based on the value of the enum.
However, it doesn’t work :-(

As an aside, the autogrid you see heer is very handy, and can be found on www.codeplex.com

What you actually need to do is slightly odd, and is effectively instantiating the enum values:

blog-25may2008-4.JPG

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: