开发者

How to find whether a property on a XAML object is bindable or not in WPF/Silverlight

For any given property of any given object definable in XAML (thinking controls, animations etc), how can I determine which properties are bindable using WPF/Silverlight binding?

I understand I could just try it out each time and look for compile/runtime errors, but I presume there's a precedent that would make it simpler (i.e. they're all dependen开发者_高级运维cy properties).


I use intellisense for it.
Say I want to know wheter or not Background for TreeViewItem is bindable (is dependency property), I type TreeViewItem.Background in the code behind file and if a BackgroundProperty pops up then I know its bindable (it'll also say DependencyProperty in the ToolTip just to be sure).

If I wanted to check IsLoaded instead there wouldn't be an IsLoadedProperty since IsLoaded isn't a dependency property.

But I agree, there has to be a better way


I just read the documentation. MSDN is good about clearly labeling which properties are dependency properties. You can only use databinding on dependency properties, so there's not much more to it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜