Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
325
What Causes CellValuePresenter.FromCell() to return null?
posted

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.
    }

  }
}

Parents Reply Children
No Data