Checkbox Binding Information in WPF
I have a code snippet as below
<CheckBox Name="cb" Margin="1,2,1,0" IsChecked="{Binding Path=IsManager}" IsEnabled="True"/>
Consider I don't know which propert开发者_StackOverflow社区y is bind to IsChecked property. I want to get programattically know the binding information of IsChecked property. How can do I that?
var binding = BindingOperations.GetBinding(cb, CheckBox.IsCheckedProperty);
Or you can get the actual expression generated for that particular instance of the binding:
var bindingExpression = BindingOperations.GetBindingExpression(cb, CheckBox.IsCheckedProperty);
精彩评论