多选 WinForms 列表框上的两种方式绑定?
我有一个项目,我们正在从对象集合中加载多选列表框。
我有另一个实体对象,它有一个集合,我想以某种方式绑定到 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,您无法绑定 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 !