added samples
[windows-sources.git] / sdk / samples / WPFSamples / MasterDetailXml / visualbasic / window1.xaml
blob177472721bdf1517f621ed2f538b06eeead22104
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"
6   Background="Cornsilk">
7     <Window.Resources>
8       <XmlDataProvider x:Key="MyList" Source="Data\Leagues.xml"
9                        XPath="Leagues/League"/>
10       <DataTemplate x:Key="dataTemplate">
11         <TextBlock Text="{Binding XPath=@name}" />
12       </DataTemplate>
13       <Style TargetType="StackPanel">
14         <Setter Property="DockPanel.Dock" Value="Left"/>
15         <Setter Property="Margin" Value="10,0,10,0"/>
16       </Style>
17       <Style TargetType="ListBox">
18         <Setter Property="Height" Value="100"/>
19       </Style>
20       <Style TargetType="Label">
21         <Setter Property="FontSize" Value="12"/>
22       </Style>
23     </Window.Resources>
25     <DockPanel DataContext="{Binding Source={StaticResource MyList}}">
26       <StackPanel>
27         <Label>My Soccer Leagues</Label>
28         <ListBox ItemsSource="{Binding}"
29                  ItemTemplate="{StaticResource dataTemplate}"
30                  IsSynchronizedWithCurrentItem="true"/>
31       </StackPanel>
33       <StackPanel>
34         <Label Content="{Binding XPath=@name}"/>
35         <ListBox Name="divisionsListBox"
36                  ItemsSource="{Binding XPath=Division}"
37                  ItemTemplate="{StaticResource dataTemplate}"
38                  IsSynchronizedWithCurrentItem="true"/>
39       </StackPanel>
41       <StackPanel Name="teamStackPanel">
42         <Label Content="{Binding XPath=@name}"/>
43         <ListBox DataContext="{Binding ElementName=divisionsListBox,
44                                        Path=SelectedItem}"
45                  ItemsSource="{Binding XPath=Team}"
46                  ItemTemplate="{StaticResource dataTemplate}"/>
47       </StackPanel>
48     </DockPanel>
49 </Window>