填充EB3中其他列表框中的ListBox项 [英] Populate ListBox Items from other Listboxes in EB3

查看:97
本文介绍了填充EB3中其他列表框中的ListBox项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用其他所选列表框项目中的项目动态填充列表框?例如,listbox1包含两个项目:A和B. Listbox2包含两个项目:C& D.我希望Listbox 3使用Listbox1中的选定项和listbox2中的选定项动态填充。谢谢。

解决方案

您可能需要在代码中执行此操作。它看起来像:

私人ObservableCollection<对象> list3source = new ObservableCollection< Object>(); //这个你将数据绑定到listbox3
...
然后你必须将代码添加到  2列表框的SelectionChangedEvent中,你可以在这里做类似的事情:
  list3source .Clear();
  list3source.Add(ListBox1.SelectedItem()。Value);
  list3source.Add(ListBox2.SelectedItem()。Value);

&NBSP;


Is it possible to dynamically populate a listbox with items from other selected listbox items? For example, listbox1 contains two items: A and B. Listbox2 contains two items: C & D. I would like Listbox 3 to dynamically populate using the selected item in Listbox1 and the selected item from listbox2. Thank you.

解决方案

you'll probably need to do this in code. It will look something like:

private ObservableCollection<Object> list3source = new ObservableCollection<Object>(); // this you will databind to listbox3
...
then you'll have to add code to the SelectionChangedEvent of the 2 listboxes where you would do something like:
 list3source.Clear();
 list3source.Add( ListBox1.SelectedItem().Value);
 list3source.Add( ListBox2.SelectedItem().Value);

 


这篇关于填充EB3中其他列表框中的ListBox项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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