WPF Reflections

May 25 2008   10:03PM GMT

WPF DataTriggers with enums



Posted by: Mark Shurmer
WPF

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


You must be logged-in to post a comment. Log-in/Register