[英]How can I display multiple rows in a DataGrid for a single row from a DataTable
I am trying to display a single data record consisting of three columns (ID, ITEM_NUMBER, and QUANTITY) across two lines in a DataGrid. 我正在尝试在DataGrid的两行中显示由三列(ID,ITEM_NUMBER和QUANTITY)组成的单个数据记录。 I am not sure if this is possible or not and I am only able to find instructions in suggested solutions using a DataGridView, which is not an option in my situation. 我不确定这是否可行,我只能使用DataGridView在建议的解决方案中找到说明,在我的情况下这不是一个选择。
I would like to display the ID on one row and the ITEM_NUMBER and QUANTITY on a row below it, along with having headers for the columns in the same layout. 我想在一行中显示ID,在其下一行显示ITEM_NUMBER和QUANTITY,并在同一布局中显示各列的标题。 Any help or suggestions would be greatly appreciated. 任何帮助或建议,将不胜感激。 Thank you. 谢谢。
Edit: I am working with the .Net 3.5 Compact Framework. 编辑:我正在使用.Net 3.5 Compact Framework。
Try grouping on ID field. 尝试对ID字段进行分组。 There is not direct control provided by .Net Framework 3.5 but solutions are available. .Net Framework 3.5没有提供直接控制,但是可以使用解决方案。 You can create user control , focus on data binding events of the DataGrid. 您可以创建用户控件,专注于DataGrid的数据绑定事件。
I think one way to solve is to overwrite the OnPaint method or to manipulate it. 我认为解决方法之一是覆盖或操作OnPaint方法。 So that you can build your own cell content. 这样您就可以构建自己的单元格内容。 I did it to show an image in a cell. 我这样做是为了在单元格中显示图像。
Otherwise I think there is no possible solution to do this. 否则,我认为没有可能的解决方案。
If you searching in general for advanced controls in CF try this out: 如果您通常在CF中搜索高级控件,请尝试以下方法:
http://www.resco.net/mobileformstoolkit/ http://www.resco.net/mobileformstoolkit/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.