I have a problem with my mind: I can’t get the basic data for working even with copied examples. In the designer, the list has 2 elements, but at run time it is empty.
<Window x:Class="BasicTables"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="BasicTables" Height="300" Width="300">
<Window.Resources>
<XmlDataProvider x:Key="data" XPath="/pages">
<x:XData>
<pages>
<page>
<id>1</id>
<name>Hello World</name>
</page>
<page>
<id>2</id>
<name>Hello World2</name>
</page>
</pages>
</x:XData>
</XmlDataProvider>
</Window.Resources>
<Grid>
<ListBox Name="ListBox1">
<ListBox.ItemsSource>
<Binding Source="{StaticResource data}" XPath="page"/>
</ListBox.ItemsSource>
</ListBox>
</Grid>
</Window>
source
share