purpleflash
December 16th, 2007, 10:28 AM
Hi, trying to bind the contents of an XML file with this code (stripped out everything before and after the StackPanel):
<StackPanel Margin="148,28,0,0" Name="stackPanel2" Grid.ColumnSpan="2">
<StackPanel.Resources>
<XmlDataProvider x:Key="publicname" Source="c:\program files\msts\users.xml" XPath="/publicname/"></XmlDataProvider>
</StackPanel.Resources>
<ListBox Height="100" Name="listBox1" Width="120" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Source={StaticResource publicname}, XPath=publicname/@name}" />
</StackPanel>
but nothing shows up in the listbox. Any ideas what I'm doing wrong here?
Using .NET 3.5. The users.xml file does exist and does have a node named "publicname" with valid data.
<StackPanel Margin="148,28,0,0" Name="stackPanel2" Grid.ColumnSpan="2">
<StackPanel.Resources>
<XmlDataProvider x:Key="publicname" Source="c:\program files\msts\users.xml" XPath="/publicname/"></XmlDataProvider>
</StackPanel.Resources>
<ListBox Height="100" Name="listBox1" Width="120" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Source={StaticResource publicname}, XPath=publicname/@name}" />
</StackPanel>
but nothing shows up in the listbox. Any ideas what I'm doing wrong here?
Using .NET 3.5. The users.xml file does exist and does have a node named "publicname" with valid data.