如题,看了windows sdk中的描述,还是不太了解这个类,希望知道的帮解释一下,谢谢~!

解决方案 »

  1.   

    这是SDK 中的说明
     
    XAML Attribute Usage 
    <object property="dependencyPropertyName"/>
    - or -
    <object property="ownerType.dependencyPropertyName"/>
    - or -
    <object property="attachedPropertyOwnerType.attachedPropertyName"/>
     
    XAML Values
    dependencyPropertyName 
    A string that specifies the DependencyProperty.Name of the desired dependency property. This can be preceded by a prefix if the property is not in the default xmlns namespace (for details, see XAML Namespaces and Namespace Mapping.)ownerType.dependencyPropertyName
    A string that specifies an owner type of a dependency property, a dot (.), then the DependencyProperty.Name. ownerType can also be preceded by a prefix. This usage is particular to late-bound styles and templates, where the owner of the dependency property must be specified for parsing context because the TargetType is not yet known. For more information, see Styling and Templating.attachedPropertyOwnerType.attachedPropertyName 
    A string that specifies the owner of an attached property, a dot (.), then the attached property name. attachedPropertyOwnerType can also be preceded by a prefix.Res
    If you want properties on your custom types to support value expressions, property invalidation, per-type default values, inheritance, data binding, animation, or styling, you should back these CLR properties with a dependency property following these guidelines and procedures: Register a dependency property using the Register method; this method returns a DependencyProperty, which you should store as an accessible static read-only field in your class. By convention, the name of this DependencyProperty identifier field should end with Property, and this convention is followed by all dependency properties implemented in WPF. For example, the Control.Background dependency property is identified by the Control.BackgroundProperty field.During registration, you can provide PropertyMetadata for the property to further define the property's behaviors, including its default value and callbacks that can be used to modify the property value in accordance to changes in related property values.Provide common language runtime (CLR) accessors for the property.If you want to create a property that can be used on all DependencyObject types regardless of whether they are within the derived class list of the class that defines the property, then you should create an attached property. An example of an attached property is the DockPanel.Dock property. For details, see Attached Properties Overview.Dependency properties in general are described in more detail in the Dependency Properties Overview. Creating custom dependency properties is described in more detail in Custom Dependency Properties.You can also create a DependencyProperty and use the property system to get and set the value without exposing common language runtime (CLR) accessors, but this is not a typical class design practice.DependencyProperty supports a XAML attribute syntax for filling property values, which is used when a Setter, Trigger, or Condition in a Style specifies its Property value. For details, see Styling and Templating. Attached properties are available from any DependencyObject, and use a distinct ownerType.propertyName syntax form in XAML. For details, see Attached Properties Overview..Example
    This example shows how to back a common language runtime (CLR) property with a DependencyProperty field, thus defining a dependency property. When you define your own properties and want them to support many aspects of Windows Presentation Foundation (WPF) functionality, including styles, data binding, inheritance, animation, and default values, you should implement them as a dependency property. The following example first registers a dependency property by calling the Register method. The name of the identifier field that you use to store the name and characteristics of the dependency property must be the Name you chose for the dependency property as part of the Register call, appended by the literal string Property. For instance, if you register a dependency property with a Name of Location, then the identifier field that you define for the dependency property must be named LocationProperty. In this example, the name of the dependency property and its CLR accessor is State; the identifier field is StateProperty; the type of the property is Boolean; and the type that registers the dependency property is MyStateControl. If you fail to follow this naming pattern, designers might not report your property correctly, and certain aspects of property system style application might not behave as expected.You can also specify default metadata for a dependency property. This example registers the default value of the State dependency property to be false. C#  Copy Code 
    public class MyStateControl : ButtonBase
    {
      public MyStateControl() : base() { }
      public Boolean State
      {
        get { return (Boolean)this.GetValue(StateProperty); }
        set { this.SetValue(StateProperty, value); } 
      }
      public static readonly DependencyProperty StateProperty = DependencyProperty.Register(
        "State", typeof(Boolean), typeof(MyStateControl),new PropertyMetadata(false));

      

  2.   

    DependencyProperty---关于这个东西,网上一大堆说明。。
    总能找到你想了解的地东西