Hi
We use a number of xamDataGrids in our application embedded inside tab controls.
We have noticed that the xamDataGrid does not release previously bound objects until the Loaded event is raised. So if a grid is not visible but its DataSource is changed it does not release the previously bound objects until the grid is made visible.
I have attached a repro project.
Is there a way to completely flush the xamDataGrid if it is not visible and thus release the previously bound objects?
I have also attached a screenshot from ANTS Memory Profiler which shows the xamDataGrid still holding onto one of the old Person objects.
Thanks
Chris
Hello Chris,
Thank you for your post and sample application.
I have been investigating your issue and it seems that it’s not caused by our XamDataGrid. You can test the sample application with WPF DataGrid and you will observe the same behavior. Also you can take a look at the following link:
http://stackoverflow.com/questions/19876890/wpf-tabcontrol-and-datagrid-bugs-bugs-and-bugs
I can suggest you to try to move your XamDataGrid in a DataTemplate in the Resources of Window:
<DataTemplate x:Key="myGrid">
<igDP:XamDataGrid x:Name="grid"
DataSource="{Binding People}">
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:Field Name="Name" />
<igDP:Field Name="Age" />
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
</DataTemplate>
and after that put the DataTemplate as ContentTemplate of TabItem:
<TabItem Header="Grid" Content="{Binding}"
ContentTemplate="{StaticResource myGrid}">
Also if you have any questions regarding Microsoft controls the best I can suggest is to take a look at the Microsoft Forum for similar issues or ask Microsoft experts about this behavior.
Please let me know if you require any further assistance on the matter.
We do not see the same behaviour with the WPF DataGrid.
I have attached another repro project that uses a WPF DataGrid. If you follow the same instructions as outlined in my original post you will see that the old Person objects are not being held onto by the WPF DataGrid.
If you un-comment the XamDataGrid code and run the same test you will see that the old Person objects are still being reference by the XamDataGrid.
Hello,
Thank you for your post.
I have logged this behavior with our developers in our tracking system, with an issue ID of 205417. I have also created a support ticket on your behalf with number CAS-163630-R0S8Q6 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.
We have shipped out a new service release where your issue is resolved. I'd be glad to find out if you had tested it out and if it had met your requirements.
You can download the Service Releases by logging to our web site and going to Account\My Keys and Downloads.
Thank you for using Infragistics Components.