views:

60

answers:

1

I have a maddening problem - I cannot get basic data binding to work even with copied examples. In the designer the listbox has 2 items but at runtime it's 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>
+2  A: 

Blimey - I hate XML Namespaces!

<pages xmlns="">
Marc