I have this problem, that my checkbox IsChecked property binding is not working. I googled, but people say it shoudl TwoWay binding which is what I am using.
Here is my code:
<CheckBox Name="ckC" VerticalAlignment="Center"
IsChecked="{Binding Path=LSMChannelEnable[2],
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" />
Here is the C# code behind it:
public bool[] LSMChannelEnable
{
get
{
return this._liveImage.LSMChannelEnable;
}
set
{
this._liveImage.LSMChannelEnable = value;
OnPropertyChanged("LSMChannelEnable");
OnPropertyChanged("EnableChannelCount");
OnPropertyChanged("LSMChannel");
}
}
Any pointers are highly appreciated,
This is because you are binding to an array. Pull the property out that you want to bind to a separate property.
Xaml:
IsChecked="{Binding Path=ButtonEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Code:
public bool ButtonEnabled
{
get { return this._liveImage.LSMChannelEnable[2]; }
set { this._liveImage.LSMChannelEnable[2] = value;
OnPropertyChanged("ButtonEnabled");
}
}
Try this:
OnPropertyChanged("Item[]");
The property generated by the compiler when using an indexer. See this blog post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With