多选 WinForms 列表框上的两种方式绑定?

发布于 2024-07-30 09:16:01 字数 195 浏览 2 评论 0原文

我有一个项目,我们正在从对象集合中加载多选列表框。
我有另一个实体对象,它有一个集合,我想以某种方式绑定到 SelectedItems。

有没有办法使用对象绑定源或某种绑定源来做到这一点,而无需编写代码? 当然,我可以循环遍历集合并获取选定的项目,但我更喜欢使用 Windows 数据绑定来更干净地完成它。

这可能吗?

I have a project where we are loading a multi-select listbox from a collection of objects.
I have another entity object that has a collection that I want to bind to SelectedItems somehow.

Is there any way to do this using object binding sources or some kind of binding source without writing code? Sure I can loop through the collection and get the selected items but I'd prefer to do it more cleanly with windows data-binding.

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

影子是时光的心 2024-08-06 09:16:01

不幸的是,您无法绑定 SelectedItems(或 CheckedListBox 中的 CheckedItems)...我不知道有多少次我希望它是可能的!

Unfortunately you can't bind the SelectedItems (or CheckedItems in CheckedListBox)... I can't tell how many times I wished it were possible !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文