views:

21

answers:

1

Imagine I had a list of names, each paired with a value ("C" for CheckBox or "R" for RadioButton).

Can I put together a template to display the correct control based on the given value?

For instance if I have "Name0, C" I'd like to display a CheckBox labeled Name0. If I have "Name1, R" I'd like to display a RadioButton labeled Name1.

Any ideas? Or is this even possible using only a template? Perhaps I would need to make the determination in the code-behind?

+1  A: 

Perhaps you could use a data template that has both a Checkbox and RadioButton. You could then create a type converter for ValueToVisability to display one and hide the other.

Nate Zaugg