简体   繁体   English

如何在 silverlight 上的复选框上绑定 2 个属性?

[英]How can you bind 2 properties on checkbox on silverlight?

I want to use 2 properties on binding the value of checkbox when loading.我想在加载时使用 2 个属性来绑定复选框的值。 This is what I have currently:这是我目前拥有的:

<CheckBox x:Name="chkIsAssigned" 
 IsChecked="{Binding IsAssigned, Mode=TwoWay}" 
 VerticalAlignment="Center" HorizontalAlignment="Center"
 Click="chkParticipantUser_ToggleCheck" />

I want to do something like IsChecked="{Binding Property1 Property2}"我想做类似 IsChecked="{Binding Property1 Property2}"

MultiBinding is not supported in Silverlight, but there are some third-party attempts to implement it externally. Silverlight 中不支持MultiBinding ,但有一些第三方尝试在外部实现它。

In your case, looking simple enough, your best bet would be to create a property in the ViewModel combining the value of the two properties on get and setting the value to the two properties on set.在您的情况下,看起来很简单,您最好的选择是在 ViewModel 中创建一个属性,结合 get 上的两个属性的值并将值设置为 set 上的两个属性。

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

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