开发者

Checkbox Binding Information in WPF

开发者 https://www.devze.com 2023-01-12 23:52 出处:网络
I have a code snippet as below <CheckBox Name=\"cb\" Margin=\"1,2,1,0\"IsChecked=\"{Binding Path=IsManager}\" IsEnabled=\"True\"/>

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消