Converter problem with XmlDataProvider
- by Andrew
Sorry for this, I've just started programming with wpf.  I can't seem to figure out why the following xaml displays "System.Xml.XmlElement" instead of the actual xml node content.  This is displayed 5 times in the listbox whenever I run it.  Not sure where I'm going wrong...
<Window x:Class="TestBinding.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Window.Resources>
        <XmlDataProvider x:Key="myXmlSource" XPath="/root">
            <x:XData>
                <root xmlns="">
                    <name>Steve</name>
                    <name>Arthur</name>
                    <name>Sidney</name>
                    <name>Billy</name>
                    <name>Steven</name>
                </root>
            </x:XData>
        </XmlDataProvider>
        <DataTemplate x:Key="shmooga">
            <TextBlock Text="{Binding}"/>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <ListBox ItemTemplate="{StaticResource shmooga}"
                 ItemsSource="{Binding Source={StaticResource myXmlSource}, XPath=name}">
        </ListBox>
    </Grid>
</Window>
Any help would be very much appreciated.  Thanks!