Wednesday, January 30, 2013

Difference between dependency property & normal property

DependencyProperty

  1. Dependency Property is a property which register another property, It is depend on not itself but depend on (for e.g.  xaml binding ) external inputs .
  2. Dependency Property is set to enable declarative code to alter the properties of an object which reduces the data requirements by providing a more powerful notification system regarding the change of data in a very specific way
  3. DependencyProperty.Register() method contain the Propertymetadata objects that stores the default value of the property. It may be also null.
  4. DependencyProperty should be register to  the normal CLR property  with Register() method by passing the property field that you use to store the data.
  5. Dependency Property can also contain the property changes notification . Using the CallBack() while registering the property can send the notification to user when the value has been chaged 
CLR Property
  1. CLR Property   Is a Classic .NET Class property. It is a normal property Which is nothing but a cross connection between fields & methods.
  2. CLR Property        Is the normal property which doesn’t have more functionality like dependency property. It is  wrapped only with get and set  arrangement to be able to retrieve and update a private member.
  3. CLR Property Need not to carry any default value .
  4. CLR property  Need to not to register with any property, it is straight forward.
  5. CLR Property    Don’t have any Notification  system.

No comments:

Post a Comment