Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF checkbox binding

While it is trivial to store a checkbox's checked state in a variable using the checkbox's Click event, how would I do it via databinding? All the examples I have found have the UI updated from some datasource, or bind one control to another; I want to update a member variable when the checkbox is clicked.

TIA for any pointers...

like image 367
Number8 Avatar asked May 15 '09 18:05

Number8


1 Answers

You must make your binding bidirectional :

<checkbox IsChecked="{Binding Path=MyProperty, Mode=TwoWay}"/> 
like image 151
Thomas Levesque Avatar answered Sep 18 '22 13:09

Thomas Levesque