Hi Team,
We are encountered some issue with Xamdatagrid control while using SelectedItems AddRange() method.
This issue occurred with 11.2 binaries.
Please find the code snippet.
PFXDataGrid is derived from XamDataGrid
/// <summary>
/// Called when [select all].
/// </summary>
/// <param name="control">The control.</param>
private static void OnSelectAll(PFXDataGrid control)
{
if (control.IsSelectAllAllowed)
if (control.Records != null && control.Records.Count > 0)
control.OnSelectAllExecution = true;
allDataRecordColl.Clear();
Utility.GetAllDataRecordsofGrid(allDataRecordColl, control.ViewableRecords);
Record[] _records = new Record[allDataRecordColl.Count];
allDataRecordColl.CopyTo(_records, 0);
control.SelectedItems.Records.Clear();
control.SelectedItems.Records.AddRange(_records);
control.OnSelectAllExecution = false;
}
/// Gets all data recordsof grid.
/// <param name="allDataRecordColl">All data record coll.</param>
/// <param name="records">The records.</param>
public static void GetAllDataRecordsofGrid(IList<Record> allDataRecordColl, IList<Record> records)
IList<Record> recColl = records as IList<Record>;
foreach (Record rec in recColl)
if (rec is GroupByRecord || rec is ExpandableFieldRecord)
GetAllDataRecordsofGrid(allDataRecordColl,rec.ViewableChildRecords);
else
if (rec is DataRecord && rec.Index != -1)
allDataRecordColl.Add(rec);
if (rec.HasChildren)
GetAllDataRecordsofGrid(allDataRecordColl, rec.ViewableChildRecords);
We are getting exception while setting AddRange method, Please find the attached screenshot for your kind reference.
Stack Track details as below:
System.NullReferenceException occurred
Message=Object reference not set to an instance of an object.
Source=InfragisticsWPF4.DataPresenter.v11.2
StackTrace:
at Infragistics.Windows.DataPresenter.DataPresenterBase.SelectedItemHolder.SelectionPositionSortComparer.CompareRecord(Record recordX, Record recordY)
at Infragistics.Windows.DataPresenter.SelectedRecordCollection.AddRange(Record[] records, Boolean ensureRecordsOrdered, Boolean fireSelectionChangeEvent)
at Infragistics.Windows.DataPresenter.SelectedRecordCollection.AddRange(Record[] records)
at CCH.CommonUIFramework.Controls.PFXDataGrid.OnSelectAll(PFXDataGrid control) in D:\Guruprasad\CCH\R2011-4.11\Main\Common\Source\CommonControls\Controls\DataGrid\PFXDataGrid.cs:line 1722
InnerException:
Thanks,
Guruprasad Gowda
Hello Guruprasad,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Hello,
Thank you for your post. I have been looking into it and I created a sample project for you following your scenario and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.