Dependency Property<br />Mahender<br />Senior Software Engineer<br />United Health Group<br />
Mahender Sarangam<br />Having 5 years of experience on .NET Technologies. Working as a Senior Software Engineer in United ...
Dependency Property<br />A Dependency Property is a static method that changes the value of a instanced object property.<b...
Any class inherits from System.Windows.DependencyObject can be extended with dependency properties.<br />Support higher le...
Microsoft Definition of DP<br />The purpose of dependency properties is to provide a way to compute the value of a propert...
A property changed callback method is invoked ,the property changed callback should also be a static/Shared method/functio...
When to choose Dependency property<br />We should implement your property as a dependency property whenever you want the p...
Demo<br />
			Thank you<br />
Upcoming SlideShare
Loading in …5
×

Dependency property

1,457 views

Published on

Published in: Business, Technology
  • Be the first to comment

  • Be the first to like this

Dependency property

  1. 1. Dependency Property<br />Mahender<br />Senior Software Engineer<br />United Health Group<br />
  2. 2. Mahender Sarangam<br />Having 5 years of experience on .NET Technologies. Working as a Senior Software Engineer in United Health Group(UHG India Information Service Ltd.). Worked with Big Firms like Deloitte Consulting & Wipro Technology. <br />Got Technical Acquaintance on Technologies like C#, ASP.NET,AJAX, LINQ, Silverlight, WPF,WCF ,SQL Server, Team Foundation Server(TFS) and SharePoint Technology. <br />MCTS Certified in Web Technologies.<br />
  3. 3. Dependency Property<br />A Dependency Property is a static method that changes the value of a instanced object property.<br />public static readonlyDependencyPropertyIsSpinningProperty = DependencyProperty.Register("IsSpinning", typeof(Boolean),typeof(Page4), null);publicboolIsSpinning{get { return(bool)GetValue(IsSpinningProperty); }set{ SetValue(IsSpinningProperty, value); }}<br />A property of an element that depends on a number of property-providers outside the element is called a "dependency property"<br />
  4. 4. Any class inherits from System.Windows.DependencyObject can be extended with dependency properties.<br />Support higher level features such as property value change notification, property validation, property coercion, property metadata and default property value inheritance.<br />Dependency Property is like any other property but can hold a default value, with built in mechanism for property value validation and automatic notification for changes in property value ( for anyone listening to property value - especially UI)  and any binding in Silverlight is to binded to a Dependency Property<br />
  5. 5. Microsoft Definition of DP<br />The purpose of dependency properties is to provide a way to compute the value of a property based on the value of other inputs. These other inputs might include external properties such as user preference, just-in-time property determination mechanisms such as data binding and animations/storyboards, multiple-use templates such as resources and styles, or values known through parent-child relationships with other elements in the object tree. In addition, a dependency property can be implemented to provide callbacks that can propagate changes to other properties.<br />
  6. 6. A property changed callback method is invoked ,the property changed callback should also be a static/Shared method/function, which take two parameters – DependencyObject and DependencyPropertyChangedEventArgs.<br />The DependencyPropertyChangedEventArgs, holds three properties <br />NewValue<br />OldValue<br />Property <br />
  7. 7. When to choose Dependency property<br />We should implement your property as a dependency property whenever you want the property to support one or more of the following Silverlight property system capabilities:<br />You want the property to be settable in a style.<br />You want the property to be a property target that supports data binding. For more information about data binding dependency properties.<br />You want the property to support an animated value, using the Silverlight animation system.<br />You want the Silverlight property system to report when the previous value of the property has been changed by actions taken by the property system itself, the environment, or the user, or by reading and using styles. Your property can specify a callback method that will be invoked each time the property system determines that your property value was definitively changed<br />
  8. 8. Demo<br />
  9. 9. Thank you<br />

×