Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
BRH 48
#DOTNET 34
#ASP.NET 29
jQuery 22
ASP.NET 20
.NET 20
WPF 9
jquery interview questions 9
jquery faq 8
ASP.NET4 8

Archive · View All
February 2011 10
September 2011 4
August 2011 4
July 2011 4
May 2011 4
April 2011 4
March 2011 4
October 2011 4
June 2011 4
January 2011 4

What is Dependency Object? How did you create Dependency Property

Jul 29 2011 9:38AM by Hima   

  • Most of the WPF classes derive from Dependency Object. All UI Elements are derived from Dependency Object.
  • The Dependency Object class gives all the functionality of the WPF dependency property system.
  • Dependency Object defines WPF Property System.
  • System.Windows.DependencyObject is used to create Dependency Property.
  • Dependency properties are the  special property in WPF that are used to support many features in WPF.

The following are steps to create DP

1. Creating Dependency Property

  Create a Property that gets inherited from dependency object

2. Register the Property, This should be public static readonly. Visual Studio 2010 gives code snippet for this (propdp). This is the property that us used to identify target property while databinding .

3. Use Property accesses' as GetValue SetValue , GetValue is used to Read the property and SetValue is used to write the property .

Below is the example for this

class Foo : DependencyObject
       {
  public int MyCustomProperty
            {
               get { return (int)GetValue(MyCustomPropertyProperty); 
	    }
               set { SetValue(MyCustomPropertyProperty, value);
         }
       }

//Using a DependencyProperty as the backing store for MyCustomProperty.  
//This enables //animation, styling, binding, etc...//Registering the property

public static readonly DependencyProperty MyCustomPropertyProperty =

DependencyProperty.Register("MyCustomProperty", typeof(int), typeof(Foo), new UIPropertyMetadata(0));
        }

While registering we need to pass the parameters as Name, Type, Type that owns property and the metadata that contains property  .

Meta Data Contains Default Value of properties information.

Coming up Attached Properties till then Happy BeyondRelationaling !!!

Tags: BRH, .NET, #DOTNET, #ASP.NET, ASP.NET, WPF FAQ, WPF, Dependency properties, Dependency Object,


Hima
31 · 6% · 1776
2
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"What is Dependency Object? How did you create Dependency Property" rated 5 out of 5 by 2 readers
What is Dependency Object? How did you create Dependency Property , 5.0 out of 5 based on 2 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]