DataRecord record = dg.FieldLayouts[0].DataPresenter.Records[0] as DataRecord;
Record rec1 = record.DataPresenter.Records[0] as Record; Record rec2 = record as Record;
I try to receive RecordPresenter of one DataRecord RecordPresenter rp1 = DataRecordPresenter.FromRecord(rec1); RecordPresenter rp2 = RecordPresenter.FromRecord(rec1);
RecordPresenter rp3 = DataRecordPresenter.FromRecord(rec2); RecordPresenter rp4 = RecordPresenter.FromRecord(rec2);
REsult: rp1 = rp2 = rp3 = rp4 = null (always)
What I must to do for receiving RecordPresenter, that is not null?
Thanks for help.
DataRecordPresenter drp= DataRecordPresenter.FromRecord(this.xamDataGrid1.ViewableRecords[0]) as DataRecordPresenter; DataRecordPresenter drp = DataRecordPresenter.FromRecord(this.xamDataGrid1.Records[0]) as DataRecordPresenter;
DataRecordPresenter drp= DataRecordPresenter.FromRecord(this.xamDataGrid1.ViewableRecords[0]) as DataRecordPresenter;
DataRecordPresenter drp = DataRecordPresenter.FromRecord(this.xamDataGrid1.Records[0]) as DataRecordPresenter;
Hi, Joe
<igDP:XamDataGrid x:Name="xamDataGrid1"
GroupByAreaLocation="AboveDataArea"
<igDP:FieldSettings
AllowEdit="False"
ExpandableFieldRecordExpansionMode="ExpandAlways"
</igDP:XamDataGrid.FieldSettings>
<igDP:FieldLayoutSettings HighlightAlternateRecords="True" />
<igDP:FieldLayout Key="FieldLayout11">
...
</igDP:XamDataGrid.FieldLayouts>
<igDP:XamDataGrid x:Name="xamDataGrid2"
<igDP:FieldLayout Key="FieldLayout12">
<igDP:XamDataGrid x:Name="xamDataGrid3"
<igDP:FieldLayout Key="FieldLayout13">
</igDP:XamDataGrid>
{
(xamDataGrid2.FieldLayouts[0].DataPresenter.Records[0] as DataRecord).IsActive = true;
(xamDataGrid1.FieldLayouts[0].DataPresenter.Records[0] as DataRecord).IsSelected = true;
DoSomethigInGrid(xamDataGrid1);
DoSomethigInGrid(xamDataGrid2);
DoSomethigInGrid(xamDataGrid3);
}
//so in this procedure drp1 != null
//so in this procedure drp2 != null
//so in this procedure drp3 != null
// when ActiveRecords != null
xdg.FieldLayouts[0].DataPresenter.Records.Count > 0 &&
DataRecordPresenter drp =
DataRecordPresenter.FromRecord(xdg.ActiveRecord) as DataRecordPresenter;
//so in this procedure drp=null
In DoSomethigInGrid(), before you are accessing the presenter , update the grid layout using xamDataGrid1.UpdateLayout();
For a similar problem of mine, the presenter had a value after the grid layout was updated.