简体   繁体   中英

All WPF control properties are dependency properties. True or False?

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 of 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.ChildrenFrameworkElement.Resources不是依赖项属性

Also the CommandParameters pre WPF 4 was CLR properties!

Taken from MSDN:

Bind to commands on InputBinding . You can bind the Command property of an InputBinding 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM