【发布时间】:2013-10-27 21:14:04
【问题描述】:
我有这个问题,我的复选框 IsChecked 属性绑定不起作用。我用谷歌搜索,但人们说它应该是 TwoWay 绑定,这就是我正在使用的。
这是我的代码:
<CheckBox Name="ckC" VerticalAlignment="Center"
IsChecked="{Binding Path=LSMChannelEnable[2],
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" />
这是它背后的 C# 代码:
public bool[] LSMChannelEnable
{
get
{
return this._liveImage.LSMChannelEnable;
}
set
{
this._liveImage.LSMChannelEnable = value;
OnPropertyChanged("LSMChannelEnable");
OnPropertyChanged("EnableChannelCount");
OnPropertyChanged("LSMChannel");
}
}
任何指针都非常感谢,
【问题讨论】:
-
附带说明,WPF Checkbox 默认情况下已经是双向绑定的。
标签: c# wpf xaml checkbox binding