如何将绑定到集合类的列呈现为 Infragistics UltraWinGrid 中的子行?
我有一个绑定到 DataSet 的 UltraWinGrid,其中几列本身就是集合类类型,如下所示:-
<代码>[名称] - 字符串
[描述] - 字符串
[组件] = 列表<组件>
[级别] = 列表<级别>
目前,最后两个字段在绑定到数据网格时是隐藏列,用于确定绑定表单上其他两个数据网格的数据。
为了提供屏幕的打印视图,我需要将其他两个数据网格设置为第一个数据网格行的子级,如下所示
- :项目1 描述
- 组件
- 组件 1 名称 |组件 1 值
- 组件 2 名称 |组件2值
- 级别
- 一级名称 | 1 级值
- 二级名称 | 2级值
- 组件
- 项目 2 名称 |项目2 说明
- 组件
- 组件 1 名称 |组件 1 值
- 组件 2 名称 |组件2值
- 级别
- 一级名称 | 1 级值
- 二级名称 | 2级值
- 组件
我怀疑我需要创建一个新的合并数据集,可能需要使用 DataRelations,但我正在努力弄清楚如何正确地取出数据。
有人能引导我走向正确的方向吗?
I have a UltraWinGrid that is bound to a DataSet, in which a couple of columns are themselves of a collection class type, like so :-
[Name] - string
[Description] - string
[Components] = List<Component>
[Levels] = List<Level>
Currently, these last two fields are hidden columns when bound to the datagrid and used to determine the data to bind two other datagrids on the form.
In order to provide a print view of the screen, I need to make the other two datagrids children of the first datagrid's rows, like so :-
- Item1 Name | Item1 Description
- Components
- Component1 Name | Component1 Value
- Component2 Name | Component2 Value
- Levels
- Level1 Name | Level1 Value
- Level2 Name | Level2 Value
- Components
- Item2 Name | Item2 Description
- Components
- Component1 Name | Component1 Value
- Component2 Name | Component2 Value
- Levels
- Level1 Name | Level1 Value
- Level2 Name | Level2 Value
- Components
I suspect I need to make a new merged dataset, possibly with DataRelations, but I'm struggling to figure out how to bring the data out correctly.
Can anyone steer me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我想我已经解决了这个问题(尽管需要一些整理)。诀窍是将“父”数据拉出到列表中(当前有一个丑陋的 foreach 循环)并将网格绑定到该列表,确保网格设置为 MultiBand。
由于这两个子集合也是 List 集合,因此它会自动处理它们。
在 这个答案,我将投票以表达我的赞赏。
Ok, think I've solved this one (albeit needs a little tidying up). The trick is to pull the "parent" data out into a List (currently with an ugly foreach loop) and bind the grid to that, ensuring you're grid is set to MultiBand.
Since the two child collections are also List collections it handles them automagically.
Discovered the solution with the help of this answer, which I shall vote up to show my appreciation.