Reputation: 45
I am trying to bind a list of objects to a list control for a Windows Phone 8 app which also contains another list within it. I have tried to find out how to set this out so that when selecting an item from the parent list the child list is then loaded into a separate list control but cannot find any details. Any help would be most appreciated as I have hit a dead end with this.
I am trying to use lists as below:
List which then contains a List which also contains a List. I need to setup an initial list of stations which the user will select one, which will then populate another list with the platforms, and then selecting a platform will load the list of trains.
Upvotes: 1
Views: 541
Reputation: 28747
You should bind your outermost list to the outermost listbox (or whatever list control you are using).
After that you can bind the selecteditem of the outerlist to the child listviews.
Here's an example:
<ListBox ItemsSource="{Binding OuterList}" x:Name="OuterList" SelectionMode="Single" />
<ListBox ItemsSource="{Binding ElementName=OuterList, Path=SelectedItem}" x:Name="Innerlist1" />
<ListBox ItemsSource="{Binding ElementName=InnerList1, Path=SelectedItem}" />
Upvotes: 1