如何在WPF中进行列表框绑定 [英] how to do listbox binding in wpf

查看:66
本文介绍了如何在WPF中进行列表框绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一些物品.每个项目都有子项目集合.现在如何将集合中每个项目的子项集合绑定到列表框?请帮帮我.

问候
Easwar

Hi
i have a collection of items. and each item is having subitems collection. now how can i bind the collection of subtems of each item in the collection to a listbox ?. please help me.

Regards
Easwar

推荐答案

可以说您的原始集合称为Parent.
此馆藏内有一个Children馆藏.

您可以尝试使用的代码类似于
lets say your original collection is called Parent.
There is a Children collection inside this collection.

What you can try is code similar to
<combobox itemsource="{Binding Parent.Children}" />

.


您可以使用 ^ ].

在Converter(Convert方法)中,您可以返回子项.
You can use Converter[^].

In the Converter (Convert method), you can return the subitems.


这篇关于如何在WPF中进行列表框绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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