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 determi开发者_如何学运维nation in the code-behind?
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.
精彩评论