WPF 数据绑定 - DataGridComboBoxColumn 和 ObjectDataProvider
我正在尝试编写一个与数据库表匹配的WPF 4.0 DataGrid,其中有两个条目,特别是GroupID和SectionID...GroupID包含组的集合,SectionID应该从采用{GroupID,SectionID}的表构建键并返回部分信息。
使用 ObjectDataProvider 将 DataGridComboBoxColumn 绑定到组表以显示组名称很容易,但鉴于我需要将项目的相关 GroupID 传递到 GetSections() 方法,我无法弄清楚如何执行这些部分ObjectDataProvider 必然...
还有其他人解决了类似的问题吗?
I'm trying to code a WPF 4.0 DataGrid that matches a database table, with two entries in particular GroupID and SectionID... GroupID contains a collection of groups, and SectionID should be built from a table that takes a {GroupID, SectionID} keys and returns section information.
Binding the DataGridComboBoxColumn to the groups table to show the group names is easy using an ObjectDataProvider, but I can't work out how to do the sections given the fact I need to pass the relevant GroupID for the item into the GetSections() method the ObjectDataProvider is bound to...
Anybody else solved something similar?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下链接详细解释了 DataGridComboBoxColumn: 链接。另外,我会尝试将 DataGrid 绑定到一个类的 ObservableCollection,在该类中为每个列添加属性,然后将每个列绑定到该类的属性。顺便说一句,我只在 C# 3.5 中这样做过......
Here is a link that explains a lot about a DataGridComboBoxColumn: link. Also, I would try to bind the DataGrid to an ObservableCollection of a class in which you add properties for each of your columns and then bind each column to a property of the class. By the way I've only done this in C# 3.5...