<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
x:Class="Flowerdatabindxml.Window1"
x:Name="Window"
Title="XML Data Source Example"
Width="400" Height="275" Background="#FFF2E882">
<Window.Resources>
<DataTemplate x:Key="FlowerTemplate">
<StackPanel>
<TextBlock Text="{Binding Mode=OneWay, XPath=FlowerName}"/>
</StackPanel>
</DataTemplate>
<XmlDataProvider x:Key="FlowersDS" d:IsDataSource="True" Source="myflowers.xml"/>
</Window.Resources>
<Grid x:Name="LayoutRoot" DataContext="{Binding Path=SelectedItem, ElementName=ListBox, Mode=Default}">
<ListBox HorizontalAlignment="Left" Margin="20,25,0,0" VerticalAlignment="Top" Width="140" Height="101" ItemTemplate="{DynamicResource FlowerTemplate}" ItemsSource="{Binding Mode=Default, Source={StaticResource FlowersDS}, XPath=/Flowers/Flower}" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" x:Name="ListBox" SelectedIndex="0"/>
<TextBlock HorizontalAlignment="Left" Margin="20,143,0,23" Width="140" Text="{Binding Mode=Default, XPath=Comments}" TextWrapping="Wrap" Background="#FFFCFCFC"/>
<TextBlock Margin="188,0,41,23" VerticalAlignment="Bottom" Height="23" Text="{Binding Mode=Default, XPath=Cost}" TextWrapping="Wrap" Background="#FFFFFFFF"/>
<Image Margin="170.26,25,14.26,61.32" Source="{Binding Mode=Default, XPath=Image}" Stretch="Fill"/>
</Grid>
</Window>