Xmldata island.xaml : XmlDataProvider « Windows Presentation Foundation « C# / CSharp Tutorial






<Window x:Class="ControlDemos.xmldataisland"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ControlDemos" Height="300" Width="300">
  <Window.Resources>
    <XmlDataProvider x:Key="MyCompany" XPath="/Company/Country">
      <x:XData>
        <Company xmlns="">
          <Country Name="USA">
            <Employee>A</Employee>
          </Country>
          <Country Name="England">
            <Employee>B</Employee>
          </Country>
          <Country Name="Japan">
            <Employee>C</Employee>
          </Country>
        </Company>
      </x:XData>
    </XmlDataProvider>
  </Window.Resources>
  <Grid>
    <StackPanel>
      <ListBox>
        <ListBox.ItemsSource>
          <Binding Source="{StaticResource MyCompany}" XPath="/Company/Country"/>
        </ListBox.ItemsSource>
        <ListBox.ItemTemplate>
          <DataTemplate>
            <StackPanel>
              <TextBlock>
                <TextBlock.Text>
                  <Binding XPath="Employee"/>
                </TextBlock.Text>
              </TextBlock>
              <TextBlock>
                <TextBlock.Text>
                  <Binding XPath="@Name"/>
                </TextBlock.Text>
              </TextBlock>
            </StackPanel>
          </DataTemplate>
        </ListBox.ItemTemplate>
      </ListBox>
    </StackPanel>
  </Grid>
</Window>
WPF Xmldata Islandxaml








24.149.XmlDataProvider
24.149.1.HierarchicalDataTemplate and XmlDataProviderHierarchicalDataTemplate and XmlDataProvider
24.149.2.Xmldata island.xamlXmldata island.xaml
24.149.3.Hierarchical Xml TemplatesHierarchical Xml Templates
24.149.4.Using XmlDataProviderUsing XmlDataProvider
24.149.5.XmlDataProvider and static Xml resourceXmlDataProvider and static Xml resource
24.149.6.Retrieve data from XmlDataProvider with XPathRetrieve data from XmlDataProvider with XPath
24.149.7.XmlDataProvider and XmlNamespaceMappingXmlDataProvider and XmlNamespaceMapping
24.149.8.XmlDataProvider and ItemsControlXmlDataProvider and ItemsControl
24.149.9.Hyperlink and xpath filter for XmlDataProviderHyperlink and xpath filter for XmlDataProvider
24.149.10.Load XmlDocument to XmlDataProviderLoad XmlDocument to XmlDataProvider
24.149.11.Get XmlElement from Bounded viewGet XmlElement from Bounded view