简体   繁体   English

有条件绑定Silverlight

[英]Conditional Binding Silverlight

I've found some questions here about this topic, but none of the solutions solve my problem. 我在这里找到了有关此主题的一些问题,但是没有一种解决方案可以解决我的问题。 I need to bind a property on a control only if a checkbox is checked. 仅在选中复选框时,才需要在控件上绑定属性。 I've seen people suggesting to create a Converter for this, but I can't access the state of a control in the converter. 我见过有人建议为此创建一个Converter,但是我无法访问Converter中控件的状态。 The only way I know is doing it on the code behind. 我知道的唯一方法是在后面的代码上执行此操作。 Does any one know any other way to do that? 有谁知道其他方法吗? Thanks. 谢谢。

If you were using WPF I would suggest a multi-binding, but unfortunately this isn't supported on Silverlight, even on SL5. 如果您使用的是WPF,我建议您使用多重绑定,但是不幸的是,Silverlight甚至SL5都不支持此功能。

However, this CodeProject article adds multi-binding support through a markup extension, so you may be able to find a solution using that. 但是,此CodeProject文章通过标记扩展添加了多绑定支持,因此您可以找到使用该解决方案的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM