We are using XamGrid from Infragistics NetAdvantage for Silverlight 11.2. There is an issue with the groupby that we have. There are a couple of columns in the grid columns are bound to an object’s property(Object.Property). In any row, this column's data is not mandatory. The column key is set to Object.Property in order to show the Property in filters and and when this column is dragged for grouping, we get a NullReferenceException. I guess this is because some of the rows have the object as null. For example:
<ig:XamGrid.GroupBySettings>
<ig:GroupBySettings AllowGroupByArea="Top" />
</ig:XamGrid.GroupBySettings>
-------------------------------------------------------------------
<ig:TextColumn Key="Employee.Name" HeaderText="Name" IsReadOnly="true">
<ig:TextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Resources.EmployeeName, Source={StaticResource LocalizedResources}}"/>
</DataTemplate>
</ig:TextColumn.HeaderTemplate>
</ig:TextColumn>
<ig:TextColumn Key="Dept.Name" HeaderText="Name" IsReadOnly="true">
<TextBlock Text="{Binding Resources.DeptName, Source={StaticResource LocalizedResources}}"/>
Can you suggest a way to have the groupby not throw the Null Reference exceptions.
Hello Arpan,
This issue has been resolved in the service release.
You can download the service release from My Keys & Downloads: https://ko.infragistics.com/Membership/Default.aspx?panel=Downloads#Downloads
Let me know if you have any questions.
Sincerely,ValerieDeveloper Support Engineer Infragisticswww.infragistics.com/support
Valerie,
Thanks for the reply. As you suggested, I downloaded the service release "NetAdvantage for Silverlight Line of Business 2011 Vol. 2 - Service Release" - Version 11.2.20112.2068. I compared dlls in here with the ones that I have(11.2.20112.1010) and there was no change in the dlls for the XamGrid.
Kindly suggets.
I am unsure what you mean by “there was no change in the dlls for the XamGrid”. Are you still receiving an exception using the service release?
If so, I am attaching the sample I used to test for the null reference exception during grouping on builds 1010 and 2068. When I run the attached sample and group by state in build 1010 I receive the exception but in 2068 grouping works as expected. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.
If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Please let me know if I can provide any further assistance.
Hi,
We ran into this same issue and our point of failure is HeaderCellControl.CancelDrag and unchecked ResolveColumn; only our TemplateColumn -typed columns are affected.
Unfortunately we cannot upgrade to 12.2 SR because it causes other issues we don't have time to resolve.
Our current workaround is as follows. Is this "enough" or should we actually release created objects at some point.
public class BFTemplateColumn : TemplateColumn { protected override CellBase GenerateHeaderCell(RowBase row) { return new BFHeaderCell(row, this); } public class BFHeaderCellControl : HeaderCellControl { protected override void CancelDrag(bool columnUnfixed, bool fireEvent) { if (this.ResolveColumn() != null) base.CancelDrag(columnUnfixed, fireEvent); } } public class BFHeaderCell : HeaderCell { public BFHeaderCell(RowBase row, Column column) : base(row, column) { } protected override CellControlBase CreateInstanceOfRecyclingElement() { return new BFHeaderCellControl(); } } }