1: <UserControl
2: x:Class="ListBoxTest.Page"
3: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
5: <Grid x:Name="LayoutRoot" Background="White" Width="400" Height="470">
6: <Border Style="{StaticResource MainBorder}">
7: <Grid>
8: <Grid.ColumnDefinitions>
9: <ColumnDefinition Width="140"/>
10: <ColumnDefinition Width="*"/>
11: </Grid.ColumnDefinitions>
12: <Grid.RowDefinitions>
13: <RowDefinition Height="auto" />
14: <RowDefinition Height="auto" />
15: <RowDefinition Height="auto" />
16: <RowDefinition Height="auto" />
17: <RowDefinition Height="auto" />
18: <RowDefinition Height="auto" />
19: </Grid.RowDefinitions>
20:
21: <Border Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" Style="{StaticResource InnerBorder}">
22: <StackPanel Orientation="Horizontal">
23: <TextBlock Text="Person Details" Width="200" />
24: <ComboBox Width="150"
25: ItemsSource="{Binding PersonList}"
26: SelectedIndex="{Binding PersonComboBoxSelectedIdx, Mode=TwoWay}">
27: <ComboBox.ItemTemplate>
28: <DataTemplate>
29: <StackPanel Orientation="Horizontal">
30: <TextBlock Text="{Binding LastName}"/>
31: <TextBlock Text=", "/>
32: <TextBlock Text="{Binding FirstName}"/>
33: </StackPanel>
34: </DataTemplate>
35: </ComboBox.ItemTemplate>
36: </ComboBox>
37: </StackPanel>
38: </Border>
39:
40: <TextBlock Grid.Column="0" Grid.Row="1" Text="Person ID" Style="{StaticResource TextBlockStyle}" />
41: <TextBlock Grid.Column="0" Grid.Row="2" Text="First Name" Style="{StaticResource TextBlockStyle}" />
42: <TextBlock Grid.Column="0" Grid.Row="3" Text="Last Name" Style="{StaticResource TextBlockStyle}" />
43:
44: <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding SelectedPerson.PersonId}" Style="{StaticResource TextBoxStyle}" />
45: <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding SelectedPerson.FirstName}" Style="{StaticResource TextBoxStyle}" />
46: <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding SelectedPerson.LastName}" Style="{StaticResource TextBoxStyle}" />
47:
48: <Border Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="4" Style="{StaticResource InnerBorder}">
49: <StackPanel Orientation="Horizontal">
50: <TextBlock Text="Address(es)" Width="200" />
51: <ComboBox x:Name="comboboxAddresses"
52: Width="150"
53: ItemsSource="{Binding SelectedPerson.Addresses}"
54: SelectedIndex="{Binding AddressesComboBoxSelectedIdx, Mode=TwoWay}">
55: <ComboBox.ItemTemplate>
56: <DataTemplate>
57: <StackPanel Orientation="Horizontal">
58: <TextBlock Text="{Binding AddressDescription}" />
59: </StackPanel>
60: </DataTemplate>
61: </ComboBox.ItemTemplate>
62: </ComboBox>
63: </StackPanel>
64: </Border>
65:
66: <ListBox Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="5"
67: ItemsSource="{Binding SelectedPerson.Addresses}"
68: SelectedIndex="{Binding AddressesComboBoxSelectedIdx, Mode=TwoWay}"
69: Style="{StaticResource ListBoxStyle}"
70: ItemContainerStyle="{StaticResource ListBoxItemStyle}">
71:
72: <ListBox.ItemTemplate>
73: <DataTemplate>
74: <Grid>
75: <Grid.ColumnDefinitions>
76: <ColumnDefinition Width="140"/>
77: <ColumnDefinition Width="*"/>
78: </Grid.ColumnDefinitions>
79: <Grid.RowDefinitions>
80: <RowDefinition Height="auto"/>
81: <RowDefinition Height="auto"/>
82: <RowDefinition Height="auto"/>
83: <RowDefinition Height="auto"/>
84: <RowDefinition Height="auto"/>
85: <RowDefinition Height="auto"/>
86: <RowDefinition Height="auto"/>
87: </Grid.RowDefinitions>
88:
89: <TextBlock Grid.Column="0" Grid.Row="0" Text="Street Address 1" Style="{StaticResource TextBlockStyle}" />
90: <TextBlock Grid.Column="0" Grid.Row="1" Text="Street Address 2" Style="{StaticResource TextBlockStyle}" />
91: <TextBlock Grid.Column="0" Grid.Row="2" Text="Street Address 3" Style="{StaticResource TextBlockStyle}" />
92: <TextBlock Grid.Column="0" Grid.Row="3" Text="Suburb" Style="{StaticResource TextBlockStyle}" />
93: <TextBlock Grid.Column="0" Grid.Row="4" Text="State" Style="{StaticResource TextBlockStyle}" />
94: <TextBlock Grid.Column="0" Grid.Row="5" Text="Post Code" Style="{StaticResource TextBlockStyle}" />
95: <TextBlock Grid.Column="0" Grid.Row="6" Text="Country" Style="{StaticResource TextBlockStyle}" />
96:
97: <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding StreetAddress1}" Style="{StaticResource TextBoxStyle}" />
98: <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding StreetAddress2}" Style="{StaticResource TextBoxStyle}" />
99: <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding StreetAddress3}" Style="{StaticResource TextBoxStyle}" />
100: <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Suburb}" Style="{StaticResource TextBoxStyle}" />
101: <TextBox Grid.Column="1" Grid.Row="4" Text="{Binding State}" Style="{StaticResource TextBoxStyle}" />
102: <TextBox Grid.Column="1" Grid.Row="5" Text="{Binding PostCode}" Style="{StaticResource TextBoxStyle}" />
103: <TextBox Grid.Column="1" Grid.Row="6" Text="{Binding Country}" Style="{StaticResource TextBoxStyle}" />
104: </Grid>
105: </DataTemplate>
106: </ListBox.ItemTemplate>
107: </ListBox>
108: </Grid>
109: </Border>
110: </Grid>
111: </UserControl>