This documentation is archived and is not being maintained.

Binding.Path Property

Gets or sets the path to the binding source property.

Namespace: System.Windows.Data
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

property PropertyPath^ Path {
	PropertyPath^ get ();
	void set (PropertyPath^ value);
/** @property */
public PropertyPath get_Path ()

/** @property */
public void set_Path (PropertyPath value)

public function get Path () : PropertyPath

public function set Path (value : PropertyPath)

<object Path="PropertyPath" .../>

Property Value

The path to the binding source. The default value is a null reference (Nothing in Visual Basic).

Each binding typically has these four components: a binding target object, a target property, a binding source, and a path to the value in the binding source to use. For more information about these data binding concepts, see Data Binding Overview.

Use the Path property to specify the source value you want to bind to:

  • In the simplest case, the Path property value is the name of the property of the source object to use for the binding, such as Path=PropertyName.

  • Subproperties of a property can be specified by a similar syntax as in C#. For instance, the clause Path=ShoppingCart.Order sets the binding to the subproperty Order of the object or property ShoppingCart.

  • Indexers of a property can be specified within square brackets following the property name where the indexer is applied. For instance, the clause Path=ShoppingCart[0] sets the binding to the index that corresponds to how your property's internal indexing handles the literal string "0". Multiple indexers are also supported.

  • Indexers and subproperties can be mixed in a Path clause; for example, Path=ShoppingCart.ShippingInfo[MailingAddress,Street].

  • Inside indexers you can have multiple indexer parameters separated by commas (,). The type of each parameter can be specified with parentheses. For example, you can have Path="[(sys:Int32)42,(sys:Int32)24]", where sys is mapped to the System namespace.

For information about the escaping mechanism for path syntax, see Binding Declarations Overview.

For XML bindings, see the XPath property.

To bind to an entire object, you do not need to specify the Path property. For more information, see "Specifying the Path to the Value" in Data Binding Overview.

The following example shows a style trigger that creates a ToolTip that reports a validation error message. The value of the setter binds to the error content of the current TextBox (the TextBox using the style) using the RelativeSource property. For more information on this example, see Implement Binding Validation.

<Style x:Key="textBoxInError" TargetType="{x:Type TextBox}">
    <Trigger Property="Validation.HasError" Value="true">
      <Setter Property="ToolTip"
        Value="{Binding RelativeSource={x:Static RelativeSource.Self},

More Code

How to: Create a Simple Binding

This example shows you how to create a simple Binding.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0