1 <Window x:Class="SDKSample.Window1"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Title="Multiple ListBox Binding Sample"
5 Width="400" Height="200"
8 <XmlDataProvider x:Key="MyList" Source="Data\Leagues.xml"
9 XPath="Leagues/League"/>
10 <DataTemplate x:Key="dataTemplate">
11 <TextBlock Text="{Binding XPath=@name}" />
13 <Style TargetType="StackPanel">
14 <Setter Property="DockPanel.Dock" Value="Left"/>
15 <Setter Property="Margin" Value="10,0,10,0"/>
17 <Style TargetType="ListBox">
18 <Setter Property="Height" Value="100"/>
20 <Style TargetType="Label">
21 <Setter Property="FontSize" Value="12"/>
25 <DockPanel DataContext="{Binding Source={StaticResource MyList}}">
27 <Label>My Soccer Leagues</Label>
28 <ListBox ItemsSource="{Binding}"
29 ItemTemplate="{StaticResource dataTemplate}"
30 IsSynchronizedWithCurrentItem="true"/>
34 <Label Content="{Binding XPath=@name}"/>
35 <ListBox Name="divisionsListBox"
36 ItemsSource="{Binding XPath=Division}"
37 ItemTemplate="{StaticResource dataTemplate}"
38 IsSynchronizedWithCurrentItem="true"/>
41 <StackPanel Name="teamStackPanel">
42 <Label Content="{Binding XPath=@name}"/>
43 <ListBox DataContext="{Binding ElementName=divisionsListBox,
45 ItemsSource="{Binding XPath=Team}"
46 ItemTemplate="{StaticResource dataTemplate}"/>