XmlDataProvider.Source Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the Uri of the XML data file to use as the binding source.
public:
property Uri ^ Source { Uri ^ get(); void set(Uri ^ value); };
public Uri Source { get; set; }
member this.Source : Uri with get, set
Public Property Source As Uri
Property Value
The Uri of the XML data file to use as the binding source. The default value is null
.
Examples
In some applications, embedding the XML inline within the XAML page can be inconvenient because the exact content of the data must be known at compile time. Therefore, you can obtain the data from an external XML file, as in the following example.
<XmlDataProvider x:Key="BookData" Source="data\bookdata.xml" XPath="Books"/>
If the XML data resides in a remote XML file, you define access to the data by assigning an appropriate URL to the Source attribute as follows:
<XmlDataProvider x:Key="BookData" Source="http://MyUrl" XPath="Books"/>
Remarks
XmlDataProvider exposes the following ways to access XML data.
You can embed inline XML data using the XmlDataProvider class.
You can set this property to the Uri of an XML data file.
You can set the Document property to an XmlDocument.
If the Source property is set, then any inline XML data is discarded. If the Document property is set, then the Source property is cleared and any inline XML data is discarded.
Setting the following properties will implicitly cause this XmlDataProvider object to refresh: Source, Document, XmlNamespaceManager, and XPath. When changing multiple refresh-causing properties, the use of DeferRefresh is recommended.