PropertyPath 类

定义

实现一个数据结构,用于将某个属性描述为另一个属性或所属类型下的路径。Implements a data structure for describing a property as a path below another property, or below an owning type. 属性路径用在对象的数据绑定中,并用在动画的演示图板和时间线中。Property paths are used in data binding to objects, and in storyboards and timelines for animations.

public ref class PropertyPath sealed
[System.ComponentModel.TypeConverter(typeof(System.Windows.PropertyPathConverter))]
public sealed class PropertyPath
type PropertyPath = class
Public NotInheritable Class PropertyPath
继承
PropertyPath
属性

注解

此类包含一个字符串Path和一个包含在字符串PathParameters Path中的依赖项属性的列表。This class contains a string Path, and list of dependency properties that are the PathParameters into the string Path.

PropertyPath支持两种行为模式:PropertyPath supports two modes of behavior:

Source 模式描述了属性的路径, 该属性用作其他操作的源。Source mode describes a path to a property that is used as a source for some other operation. Binding该类使用此模式来支持数据绑定。This mode is used by the Binding class to support data binding.

目标模式描述将被设置为目标属性的属性的路径。Target mode describes a path to a property that will be set as a target property. 此模式由动画用于支持情节提要和时间线资源库。This mode is used by animation in support of storyboard and timeline setters.

例如, Background.Opacity是一个两步路径。For instance, Background.Opacity is a two-step path. 此路径隐含: 首先, 查找Background对象的属性, 获取Background属性设置为的值对象, 然后Opacity获取该对象的属性值。This path implies: first, find the Background property of an object, get the value object that the Background property is set to, and then get the value of the Opacity property on that object.

XAML 属性用法XAML Attribute Usage

<object property="propertyPath" .../>  

XAML 值XAML Values

propertyPathpropertyPath
计算为简单或复杂属性路径的字符串。A string that is evaluated to be either a simple or complex property path. 用于设置PropertyPathXAMLXAML的语法是通用的, 但却是复杂的, 并且在单独的主题PropertyPath XAML 语法中进行了介绍。The syntax for setting a PropertyPath in XAMLXAML is versatile but complex, and is described in the separate topic PropertyPath XAML Syntax.

构造函数

PropertyPath(Object)

初始化 PropertyPath 类的新实例。Initializes a new instance of the PropertyPath class.

PropertyPath(String, Object[])

使用提供的路径标记字符串和参数初始化 PropertyPath 类的一个新实例。Initializes a new instance of the PropertyPath class, with the provided pathing token string and parameters.

属性

Path

获取或设置描述路径的字符串。Gets or sets the string that describes the path.

PathParameters

获取要在路径引用索引参数时使用的参数列表。Gets the list of parameters to use when the path refers to indexed parameters.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅