您可以告诉您如何获取WPF Grid中的选定列名称或索引。如何获取WPF Grid中的选定列名称或索引
1
A
回答
0
这是我们可以得到一个特定的细胞
Object obj = GetCell(3).Content;
string cellContent = String.Empty;
if (obj != null)
{
if (obj is TextBox)
cellContent = ((TextBox)(obj)).Text;
else
cellContent = ((TextBlock)(obj)).Text;
}
private DataGridCell GetCell(int column)
{
DataGridRow rowContainer = GetRow();
if (rowContainer != null)
{
DataGridCellsPresenter presenter = GetVisualChild<DataGridCellsPresenter>(rowContainer);
// Try to get the cell but it may possibly be virtualized.
DataGridCell cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
if (cell == null)
{
// Now try to bring into view and retreive the cell.
customDataGrid.UCdataGridView.ScrollIntoView(rowContainer, customDataGrid.UCdataGridView.Columns[column]);
cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
}
return cell;
}
return null;
}
0
1
相关问题
- 1. 获取索引的名称
- 2. 获取选定的Datagrid行索引或列索引
- 3. 如何从sys.dm_tran_locks获取索引名称
- 4. 获取选定列表框项目的名称(WPF C#)?
- 5. 如何获取选定collectionviewcell的名称?
- 6. 如何从列表中获取选定列名称
- 7. 如何获取芯片名称或芯片索引?
- 8. 如何获取特定名称的行索引号?
- 9. javascript - 如何获取对象名称或关联数组索引名称?
- 10. 如何获取或设置wpf色带组合框的选定索引?
- 11. 如何获取JCheckbox的选定索引?
- 12. 获取选定列的索引(DataTables + ColVis)
- 13. 如何从下拉列表中获取未选定的索引?
- 14. RethinkDB:获取索引内的索引,而不是索引名称
- 15. 获取选定的行列值extjs grid
- 16. 如何从Syncfusion MVC Grid的选定行中获取列值
- 17. 在特定表名中获取索引名称
- 18. 如何获取WPF列表框实例中的listboxitem的索引?
- 19. 如何获取WPF Datagrid的行索引?
- 20. 如何取出数据帧中的列索引名称
- 21. 如何在Elasticsearch中过滤或查询索引名称列表?
- 22. 如何在wpf中获取默认选定打印机的端口名称
- 23. 如何获取在wpf中绑定到datagrid列的属性的名称?
- 24. 从radgrid获取选定的行索引和列索引
- 25. 如何获取WPF网格中选定单元格的行索引
- 26. 如何通过名称使用WebElement硒获取表中列的索引C#
- 27. 如何从JavaScript中的Kendo Grid对象获取隐藏的列字段名称
- 28. 获取radioGroup中选定RadioButton的索引
- 29. 获取LongListSelector中的选定索引
- 30. 获取GridView中选定行的索引
你的意思GridView控件或DataGrid的价值? – HCL
我的意思是基于WPF的GRID – Abhi