Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
XPath Property

Binding::XPath Property

Gets or sets an XPath query that returns the value on the XML binding source to use.

Namespace:  System.Windows.Data
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public:
property String^ XPath {
	String^ get ();
	void set (String^ value);
}
<object XPath="string" .../>

Property Value

Type: System::String
The XPath query. The default is nullptr.

When the binding source is XML data instead of a common language runtime (CLR) object, the XPath property is used instead of the Path property to indicate the path to the value on the binding source to use.

By setting the XPath property, you are creating an XPath query to select a node or a collection of nodes (System.Xml::XmlElement and System.Xml::XmlAttribute both derive from System.Xml::XmlNode). System.Xml::XmlNode is a common language runtime (CLR) object, which means you can bind to its properties using the Path property.

The XmlNode::SelectNodes method handles the XPath expressions from the XPath property. XPath functions are not supported. For XPath expression information, see the SelectNodes documentation and some examples provided in the Example section.

LINQ to XML objects XDocument and XElement do not use XPath. For details, see How to: Bind to XDocument, XElement, or LINQ for XML Query Results.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft