Editar

Compartilhar via


PropertyPath.Path Property

Definition

Gets or sets the string that describes the path.

public:
 property System::String ^ Path { System::String ^ get(); void set(System::String ^ value); };
public string Path { get; set; }
member this.Path : string with get, set
Public Property Path As String

Property Value

The string that describes the path.

Remarks

The string contained in this property has three completely different meanings depending on whether a PropertyPath is being used for a source-mode property path for a binding, for a target-mode single-step property path for a storyboard target, or for a complex path for a storyboard target.

If using this PropertyPath in source mode for a binding, Path is a string representing a property name, or can be a string that describes a "step-through" path to the property in the CLR object model of the object that is being used as the source for a binding. For a binding property path, the character that identifies a "step" is a dot (.). Indexer references (including multiple indexers, and type differentiation) are also supported. For more details on the syntax of the string as specifically used by the Binding object, see Binding.Path. A property used as a binding source need not be a dependency property. If the binding updates two-way, the property source must be read-write. Also note that the binding target does have to be a dependency property. For details, see Data Binding Overview.

If using this PropertyPath in target mode for a single-step path for a storyboard target, PropertyPath is a string that is a typeName.propertyName qualified dependency property name string.

If using this PropertyPath for a complex path for a storyboard target, Path is a tokenized string format that describes the relationships of the various objects given in the PathParameters.

  • Each item in the array is specified in this format by the array index for the item enclosed in parentheses. For example, to specify the first item in the array, the string token is (0).

  • Relationships between items ("steps" in the path) are specified by a dot (.). The property forward of the dot is the first step in the path, the property after is the second step, and so on (you can specify steps beyond two). The last step in the chain always represents the property being animated.

  • Items within collection properties are accessed with an indexer syntax, with the index within square brackets ([ and ]). The indexer is additive to the token representing the property. For example, the following is a two-step path, with the token combination in the first step specifying the second item from within the collection of that property: (0)[1].(1) . You cannot use an indexer on the last property in the chain; you cannot animate the actual collection position, you must animate a property on that object.

The path string for a PropertyPath is typically established through the constructors: the PropertyPath(Object) signature for bindings or single-step storyboard targets, the PropertyPath(String, Object[]) signature for multi-step storyboard targets.

XAML: When you use a PropertyPath to describe a property reference in XAML, as an attribute value, the string that you specify is first handled by a type converter (PropertyPathConverter). This type converter then processes the string and based on its syntax will call one of the PropertyPath constructor signatures. This indirection through the type converter handling an attribute value is generally how you use PropertyPath in XAML, rather than declaring a PropertyPath object element and then applying specific values to attributes such as Path and PathParameters. For more information, see PropertyPath XAML Syntax.

XAML Text Usage

Members of the PropertyPath type are not typically set in a direct XAML syntax. See Remarks.

Applies to