While answering this question I noticed that I have never come across any property which is not a dependency property (WPF Controls, no 3rd party controls). Although, when I started with WPF I remember reading somewhere that "more then 90% of properties o开发者_JAVA百科f WPF controls are dependency properties".
Can anyone give examples/links of CLR properties in WPF controls and why it's so?
Update:
Came across this lecture: http://www.miszalok.de/Lectures/L17_WPF/C4_DependencyProperties/DependencyProperties.pdf
Which says:
Label has 18 traditional and 71 dependency properties.
Button has 18 traditional and 78 dependency properties.
The PasswordBox property Password is not implemented as dependency property to not allow data binding, which would be a security risk otherwise. See this post for details.
Panel.Children
or FrameworkElement.Resources
are not dependency properties
Also the CommandParameters
pre WPF 4 was CLR properties!
Taken from MSDN:
Bind to
commands
onInputBinding
. You can bind the Command property of anInputBinding
class to an instance that is defined in code. The following properties are dependency properties, so that they can be targets of bindings:
- InputBinding.Command
- InputBinding.CommandParameter
- InputBinding.CommandTarget
- KeyBinding.Key
- KeyBinding.Modifiers
- MouseBinding.MouseAction
http://msdn.microsoft.com/en-us/library/bb613588.aspx
精彩评论