I have a grid layout saved to XML and it contain when I load it into an UlraGridLayout I get the following error.
Unhandled exception on background thread: If summaryType is Custom, then a valid instance of ICustomSummaryCalculator must be passed in.
I haven't even loaded the layout onto the grid. I am simply loading the layout into a variable for evaluation.
What is happening here??
Thanks
-Ken
Hello Ken,
Thank you for posting in our forums!
It seems that you try to add or you already have custom summary cell`s settings object that does not implement ICustomSummaryCalculator interface. UltraGrid actually does not serialize custom summary cell`s settings, since it is an object of interface type with custom logic that can be implemented on any other object. Therefore if you are adding a new custom summary settings to the band`s collection of the UltraGrid, you have to use another constructor with parameter of class that implements ICustomSummaryCalculator interface. For further reference about appropriate constructor`s type and implementation of the ICustomSummaryCalculator interface, see the following documentation page:
http://help.infragistics.com/doc/WinForms/2014.1/CLR4.0/?page=Infragistics4.Win.UltraWinGrid.v14.1~Infragistics.Win.UltraWinGrid.SummarySettingsCollection~Add(SummaryType,ICustomSummaryCalculator,UltraGridColumn,SummaryPosition,UltraGridColumn).html
Please let me know if you need any further assistance or I am missing something.
Thanks for the response! I understand all that and have already went down that path. The problem is that it is actually throwing the unhandled exception just loading the xml. It has nothing to do with the Grid. Tell me where I can send you the XML file and you can load it like I have below.
UltraGridLayout persistedLayout = new UltraGridLayout(); try { byte[] bytes = File.ReadAllBytes("path to the file"); MemoryStream memoryStream = new MemoryStream(bytes); persistedLayout.LoadFromXml(memoryStream); } catch { //It catches here just loading the file. }
Ok, here it is. Please let me know when you have had a chance to load the file via the code sample I posted.
Thank you for the provided xml file!
Based on the provided information, I have managed to reproduce your issue. Since in the xml file you have two summary settings cells of type custom [<SummaryType>5</SummaryType>], runtime when the file is loading it throws exception because it is looking for the ICustomSummaryCalculator interface. As I mentioned we do not serialize interface objects like summaries of type custom, so the UltraGrid`s layout does not expect to find them in the xml. It seems that it was a bug on our previous Infragistics versions as 11.1, the version that your xml file has been serialized with.
Therefore in order to keep the values of the summary cells true, you have to change the SummaryType to appropriate ones that fits the summary requirements. I have noticed that the names of the summaries probably ends to the types that they should display (ContractValueSum and OrderNumberCount). So I have changed them to [<SummaryType>1</SummaryType>] and [<SummaryType>4</SummaryType>] respectively. There is no guarantee that this is the right scenario in your case, but it is the fastest approach with decent chances of success. On the other hand if the summaries logic is more complicated than the standard summary types, you can change them to external. The last possible approach is just to delete the summary settings from the xml file, in case you are not going to use summaries cells in the UltraGrid.
For further reference about the SummaryType enumeration and external summary calculations, see the following documentation pages: http://help.infragistics.com/Help/Doc/WinForms/2012.2/CLR4.0/HTML/Infragistics4.Win.UltraWinGrid.v12.2~Infragistics.Win.UltraWinGrid.SummaryType.html http://help.infragistics.com/doc/WinForms/2014.1/CLR4.0/?page=WinGrid_Performing_External_Summary_Calculations.html
Please refer to the attached file on the bottom of this post, where the xml is modified as explained in the above sentences.
I am waiting for your feedback.
Thanks for all the info! I am guessing I won't see the problem with 14.1 of infragistics?
If that is the case we will be updating in the next week to that version.
Checking out the XML that is attached.
Although the upgrade to Infragistics 14.1 will prevent saving the custom summaries cells of the UltraGrid`s layout, loading xml file that contains custom summaries serialized with Infragistics 11.1 will still throws an exception. Therefore the attached xml file have to be edited manually using one of the possible approaches listed in my previous post.
Please let me know if you need any further assistance.
I am just checking about the progress of this issue.
Please let me know if you need any further assistance on it or if I am missing something.
Thank you for using Infragistics Components!