考虑我有一个数据网格,我需要找到数据网格中的行数和列数。我怎样才能在 C# 中做到这一点?
The DataGrid.Items
属性返回一个DataGridItemCollection
代表着DataGridItems
在数据网格中。
Each DataGridItem
代表渲染表中的一行。另外,DataGridItem
暴露了一个Cells
代表编号的属性。渲染表中的表格单元格(换句话说,列)的数量。
int rowCount = myGrid.Items.Count;
// Get the no. of columns in the first row.
int colCount = myGrid.Items[0].Cells.Count;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)