在列表框 WP8 中绑定列表框

Binding ListBox inside a listBox WP8

我需要在 ContryListBox 中绑定一个名为 cityListBox 的列表框,其结构如下 class

public class Country
{
    public Country();

    public string ID { get; set; }

    public List<City> LstCity { get; set; }

    public string Title { get; set; }
}

我希望我的外部列表框应该带有国家/地区标题 header 并且在内部列表框城市 header 中城市也是 class 与 Id 和标题

我的xaml代码:

       <ListBox x:Name="ContryListBox">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel>

                        <Bewise:ExpanderControl HeaderText="{Binding Title, Mode=OneWay}" >
                            <Bewise:ExpanderControl.ContentArea>


                                <ListBox x:Name="cityListBox " >
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel>
                                                <CheckBox></CheckBox>
                                                <TextBlock Text="{Binding Title}"/>
                                            </StackPanel>

                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>


                            </Bewise:ExpanderControl.ContentArea>

                        </Bewise:ExpanderControl>


                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
<!--Added ItemsSource binding-->
<ListBox x:Name="ContryListBox" ItemsSource="{Binding YourCountryListProperty}>
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel>
                    <Bewise:ExpanderControl HeaderText="{Binding Title, Mode=OneWay}" >
                        <Bewise:ExpanderControl.ContentArea>
                            <!--Added ItemsSource Binding-->
                            <ListBox x:Name="cityListBox" ItemsSource="{Binding LstCity}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel>
                                            <CheckBox></CheckBox>
                                            <TextBlock Text="{Binding Title}"/>
                                        </StackPanel>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Bewise:ExpanderControl.ContentArea>
                    </Bewise:ExpanderControl>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>