x:XData Intrinsic XAML Type
Enables placement of XML data islands within a XAML production. XML elements within
x:XData should not be treated by XAML processors as if they are a part of the acting default XAML namespace or any other XAML namespace.
x:XData can contain arbitrary well-formed XML.
XAML Object Element Usage
<x:XData> <elementDataRoot> [elementData] </elementDataRoot> </x:XData>
||The single root element of the enclosed data island. For most eventual consumers, XML that does not have a single root is considered invalid. In particular, a single root is required if the
||Optional. XML that represents the XML data. Any number of elements can be contained as element data and nested elements can be contained in other elements; however, the general rules of XML apply.|
The XML elements within an
x:XData object can re-declare all possible namespaces and prefixes of the containing XMLDOM within the data.
Programmatic access to XML data and the
x:XData intrinsic XAML type is possible in .NET XAML Services through the XData class.
WPF Usage Notes
x:XData object is primarily used as a child object of an XmlDataProvider, or alternatively, as the child object of the XmlDataProvider.XmlSerializer property (in XAML, this is typically expressed in property element syntax).
The data should typically redefine the base XML namespace within the data island to be a new default XML namespace (set to an empty string). This is easiest for simple data islands because the XPath expressions that are used to reference and bind to the data can avoid inclusion of prefixes. More complex data islands might define multiple prefixes for the data and use a specific prefix for the XML namespace at the root. In this case, all XPath expression references should include the appropriate namespace-mapped prefix. For more information, see Data Binding Overview.