I am iterating over a xamdataGrid via the records collection using the code below. What causes the CellValuePresenter to return null? The record exists in the xamDataGrid, has a cell and the cell has a value. The iteration code is take from your documentation site. The datagrid is part of a ContentPane that is being loaded, displayed and controls recursed for values via Visual/LogicalTreeHelpers at run-time.
foreach (Record record in records){ if (record.RecordType == RecordType.GroupByField || record.RecordType == RecordType.GroupByFieldLayout) { GroupByRecord groupRecord = (GroupByRecord)record; //TODO: Add logic to process the group by record
} else if (record.RecordType == RecordType.DataRecord) { DataRecord dataRecord = (DataRecord)record;
foreach (Cell cell in dataRecord.Cells) { CellValuePresenter cellValuePresenter = CellValuePresenter.FromCell(cell); // CellValuePresenter is null when file is loaded and recursed immediately after load. // CellValuePresenter is not null when loaded, displayed and then recursed
// unrelated code omitted. }
}}
I found, surprisingly, issue with CellValuePresenter.FromCell(currentCell) returns null when currentCell is active cell and having valid cell values within it, please help me in this case
Hello Jeremiah,
I am just checking if you require any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thank you for your reply. I have been reading through it and the CellValuePresenter.FromCell method can return null, when the cell, to which the CellValuePresenter corresponds is not currently in view. This is caused by the virtualization of the visual elements of the XamDataGrid. You can read more detailed information regarding the virtualization of the XamDataGrid here in our online documentation: http://help.infragistics.com/NetAdvantage/WPF/2012.1/CLR4.0/?page=xamData_Cells_CellValuePresenters_and_Cell_Virtualization.html and here: http://help.infragistics.com/NetAdvantage/WPF/2012.1/CLR4.0/?page=xamData_Performance_Optimizations_Overview.html
Please let me know if you need any further assistance on the matter.