Breyta

Deila með


DependencyProperty Class

Definition

Caution

The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*

A special kind of property that can be defined or attached to a DependencyObject. There are three kinds of dependency properties: instance properties, meta properties, and attached properties. This class cannot be inherited.

public ref class DependencyProperty sealed : System::Runtime::Serialization::ISerializable
[System.Serializable]
public sealed class DependencyProperty : System.Runtime.Serialization.ISerializable
[System.Serializable]
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public sealed class DependencyProperty : System.Runtime.Serialization.ISerializable
[<System.Serializable>]
type DependencyProperty = class
    interface ISerializable
[<System.Serializable>]
[<System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>]
type DependencyProperty = class
    interface ISerializable
Public NotInheritable Class DependencyProperty
Implements ISerializable
Inheritance
DependencyProperty
Attributes
Implements

Examples

The following example shows how to register a DependencyProperty for use by a DependencyObject. This code example is part of the Send Email SDK sample and is from the SendMailActivity.cs file. For more information, see Send Mail Activity.

// Define the DependencyProperty objects for all of the Properties
// ...and Events exposed by this activity
public static DependencyProperty FromProperty = DependencyProperty.Register("From", typeof(string), typeof(SendEmailActivity), new PropertyMetadata("someone@example.com"));
public static DependencyProperty ToProperty = DependencyProperty.Register("To", typeof(string), typeof(SendEmailActivity), new PropertyMetadata("someone@example.com"));
' Define the DependencyProperty objects for all of the Properties 
' ...and Events exposed by me activity
Public Shared FromEmailProperty As DependencyProperty = DependencyProperty.Register("From", GetType(String), GetType(SendEmailActivity), New PropertyMetadata("someone@example.com"))
Public Shared ToProperty As DependencyProperty = DependencyProperty.Register("To", GetType(String), GetType(SendEmailActivity), New PropertyMetadata("someone@example.com"))

Remarks

Note

This material discusses types and namespaces that are obsolete. For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

Dependency properties support three use cases. First, if an instance property of an activity is implemented by using a dependency property, that property can be assigned an ActivityBind instead of an actual value. Second, activity properties that are metadata (that is, the value cannot change at run time) should be implemented by using dependency properties, specifying the Metadata option. Third, dependency properties support attached properties, which are properties that are applied to dependency objects dynamically.

Properties

DefaultMetadata

Gets the PropertyMetadata that represents user-defined data for this DependencyProperty.

IsAttached

Gets the property that indicates whether this DependencyProperty is associated to a DependencyObject by registration.

IsEvent

Gets the property that indicates whether the DependencyProperty is an event Delegate.

Name

Gets the Name of the DependencyProperty.

OwnerType

Gets the Type of the DependencyProperty.

PropertyType

Gets the Type of the value stored in the DependencyProperty.

ValidatorType

Gets the Type implementing validation logic specific to the DependencyProperty.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
FromName(String, Type)

Gets the registered DependencyProperty based on the Name and OwnerType.

FromType(Type)

Creates an IList of type DependencyProperty that belong to a specific Type.

GetHashCode()

Returns the hash code for this instance.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Register(String, Type, Type, PropertyMetadata)

Initializes a new instance of the DependencyProperty class that has the properties parameterized according to the input parameters.

Register(String, Type, Type)

Initializes a new instance of the DependencyProperty class that has the properties parameterized according to the input parameters.

RegisterAttached(String, Type, Type, PropertyMetadata, Type)

Initializes a new instance of the DependencyProperty class that has the properties parameterized according to the input parameters.

RegisterAttached(String, Type, Type, PropertyMetadata)

Initializes a new instance of the DependencyProperty class that has the properties parameterized according to the input parameters.

RegisterAttached(String, Type, Type)

Initializes a new instance of the DependencyProperty class that has the properties parameterized according to the input parameters. This instance is intended to declare properties that are used on objects other than the objects of owning type.

ToString()

Overrides the Object method to return the Name property value.

Explicit Interface Implementations

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

Populates a SerializationInfo with the data required to serialize the target object.

Applies to