Redigera

Dela via


XmlDataProvider.XmlNamespaceManager Property

Definition

Gets or sets the XmlNamespaceManager used to run XPath queries.

public:
 property System::Xml::XmlNamespaceManager ^ XmlNamespaceManager { System::Xml::XmlNamespaceManager ^ get(); void set(System::Xml::XmlNamespaceManager ^ value); };
public System.Xml.XmlNamespaceManager XmlNamespaceManager { get; set; }
member this.XmlNamespaceManager : System.Xml.XmlNamespaceManager with get, set
Public Property XmlNamespaceManager As XmlNamespaceManager

Property Value

The XmlNamespaceManager used to run XPath queries. The default value is null.

Examples

The following example demonstrates how to use this property.

<StackPanel.Resources>
  <XmlNamespaceMappingCollection x:Key="mapping">
    <XmlNamespaceMapping Uri="http://purl.org/dc/elements/1.1/" Prefix="dc" />
  </XmlNamespaceMappingCollection>

  <XmlDataProvider Source="http://msdn.microsoft.com/subscriptions/rss.xml"
                   XmlNamespaceManager="{StaticResource mapping}"
                   XPath="rss/channel/item" x:Key="provider"/>

  <DataTemplate x:Key="dataTemplate">
    <Border BorderThickness="1" BorderBrush="Gray">
      <Grid Width="600" Height="50">
        <Grid.RowDefinitions>
          <RowDefinition Height="25"/>
          <RowDefinition Height="25"/>
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" Text="{Binding XPath=title}" />
        <TextBlock Grid.Row="1" Text="{Binding XPath=dc:date}" />
      </Grid>
    </Border>
  </DataTemplate>
</StackPanel.Resources>

<ListBox
  Width="600"
  Height="600"
  Background="Honeydew"
  ItemsSource="{Binding Source={StaticResource provider}}"
  ItemTemplate="{StaticResource dataTemplate}"/>

Remarks

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.

XAML Attribute Usage

<object XmlNamespaceManager="mappingCollection"/>  

XAML Values

mappingCollection
An XmlNamespaceMappingCollection. To refer to a XmlNamespaceMappingCollection, use the Markup Extensions and WPF XAML.

Applies to

See also