WP8 XAML 绑定列表<>与另一个列表<>里面 [英] WP8 XAML Binding List<> with another List<> inside

查看:34
本文介绍了WP8 XAML 绑定列表<>与另一个列表<>里面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将对象列表绑定到 Windows Phone 8 应用程序的列表控件,该应用程序中还包含另一个列表.我试图找出如何设置它,以便在从父列表中选择项目时,子列表会加载到单独的列表控件中,但找不到任何详细信息.任何帮助将不胜感激,因为我已经陷入了死胡同.

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 然后包含一个 List,而 List 又包含一个 List.我需要设置一个初始车站列表,用户将选择一个车站,然后用平台填充另一个列表,然后选择一个平台将加载列车列表.

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.

推荐答案

您应该将最外层列表绑定到最外层列表框(或您正在使用的任何列表控件).

You should bind your outermost list to the outermost listbox (or whatever list control you are using).

之后就可以将outerlist的selecteditem绑定到子listviews上.

After that you can bind the selecteditem of the outerlist to the child listviews.

这是一个例子:

<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}" />

这篇关于WP8 XAML 绑定列表&lt;&gt;与另一个列表&lt;&gt;里面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆