简体   繁体   English

如何在DataGrid中为DataTable中的单行显示多行

[英]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.

相关问题 如何从DataTable1.Row [i] [j]读取字符串值到DataTable2的数组或多行中 - How to read string value from DataTable1.Row[i][j] into an array or multiple rows of DataTable2 如何连接一行中的所有列值,然后将DataTable中的所有行连接成一个字符串? - How can I concatenate all the column values in a row, and then concatenate all rows in a DataTable into a single string? 如何为DataGrid中的每一行生成复选框或仅用于选择多行的复选框? - How can I for each row in DataGrid generate checkbox or whatever just to select a multiple rows? c#如何通过命令从datagrid复制多行 - c# how i can copy multiple rows from datagrid through command 如何将单行显示为从数据库到gridview的多行? - How to display single row as multiple row from database to gridview? 如何使用绑定将多个表显示到一个数据网格中? - How can I display multiple tables into a datagrid using binding? 更新数据表中一行中包含多个行的单个单元格 - Update A Single cell within a row in datatable which contains multiple rows 如何仅使用选定的复选框行从数据网格创建数据表 - How to create a datatable from a datagrid using only selected checkbox rows 如何单独从ViewModel以编程方式突出显示DataGrid行? - How can I highlight a DataGrid row programmatically from the ViewModel alone? 如何从 Excel 的 DataTable 中删除空行? - How can i remove empty rows from DataTable from Excel?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM