Generally, there are n different methods to implement certain functions under the. NET Framework. Using "property" is one of them. You can use both CLR property and Dependency Property.
If you are not familiar with these two things, let's briefly introduce them. Let's take a look at the most frequently used CLR property in. Net:
Public String authorname {Get; set ;}
Familiar with zookeeper?
Dependency properties was a concept proposed in WPF a few years ago and was later extended to Silverlight (WPF/E ).
Public static readonly dependencyproperty authornameproperty = dependencyproperty. Register ("authorname", typeof (string), typeof (PAGE), new propertymetadata (""));
CLR porperty is obviously more easy to understand, at least it is easier to remember. In contrast, even for a WPF or Silverlight veteran, it is much more troublesome to learn to declare a dependencyproperty.
However, dependencyproperty provides more functions than the traditional CLR property. It can set attributes for an animation, Data Association, and resource storage. For more information, see this article.
We can observe the differences between the two attributes through the "generate attribute" function in blend to give a rough understanding of them. For example, when a CLR property is generated:
, Many Command Options are grayed out. Let's take a look at Dependency Property
It not only retains all the functions of CLR property, but also adds support for converting to resources and data association. Of course, it is quite easy to operate an animation.
Stand up and applaud!