1 / 9

Dependency Property

Dependency Property. Mahender Senior Software Engineer United Health Group. Mahender Sarangam.

dotty
Download Presentation

Dependency Property

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Dependency Property Mahender Senior Software Engineer United Health Group

  2. Mahender Sarangam • 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. • Got Technical Acquaintance on Technologies like C#, ASP.NET,AJAX, LINQ, Silverlight, WPF,WCF ,SQL Server, Team Foundation Server(TFS) and SharePoint Technology. • MCTS Certified in Web Technologies.

  3. Dependency Property • A Dependency Property is a static method that changes the value of a instanced object property. • public static readonlyDependencyPropertyIsSpinningProperty = DependencyProperty.Register("IsSpinning", typeof(Boolean),typeof(Page4), null);publicboolIsSpinning{get { return(bool)GetValue(IsSpinningProperty); }set{ SetValue(IsSpinningProperty, value); }} • A property of an element that depends on a number of property-providers outside the element is called a "dependency property"

  4. Any class inherits from System.Windows.DependencyObject can be extended with dependency properties. • Support higher level features such as property value change notification, property validation, property coercion, property metadata and default property value inheritance. • 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

  5. Microsoft Definition of DP • 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.

  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. • The DependencyPropertyChangedEventArgs, holds three properties • NewValue • OldValue • Property

  7. When to choose Dependency property • 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: • You want the property to be settable in a style. • You want the property to be a property target that supports data binding. For more information about data binding dependency properties. • You want the property to support an animated value, using the Silverlight animation system. • 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

  8. Demo

  9. Thank you

More Related