将Infragistics UltraGridRow转换为DataRow

Mik*_*ter 2 c# infragistics datarow ultrawingrid

有没有简单的方法将infragistics转换UltraGridRow为标准DataRow对象?

Ste*_*eve 5

如果您已将UltraGrid的DataSource设置为DataTable,那么您可以使用当前ActiveRow提取基础DataRow

 if(grid.ActiveRow != null && grid.ActiveRow.IsDataRow)
 {
      DataRow row = (grid.ActiveRow.ListObject as DataRowView).Row;
 }
Run Code Online (Sandbox Code Playgroud)

当然,您可以将此示例的ActiveRow替换为IsDataRow属性为true的每个UltraGridRow(谨防SummaryRows和OutlookGroupByRow)

请注意,如果绑定到DataSource a List<CustomClass>,ListObject则能够返回该单个实例CustomClass