开发者

Silverlight Conditional CheckBox/RadioButton

开发者 https://www.devze.com 2023-01-08 23:30 出处:网络
Imagine I had a list of names, each paired with a value (\"C\" for CheckBox or \"R\" for RadioButton).

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号