I am creating a custom summary similar to this one: http://help.infragistics.com/Help/Doc/WPF/2014.1/CLR4.0/html/xamGrid_Create_a_Custom_Summary.html
My data is a class that we have developed and it is similar to the TimeSpan class.
In Summarize method of the SynchronousSummaryCalculator implementation, I return the TotalMinutes.
However, in the summary row, I need to instantiate a new object of my class with the sum of the returned TotalMinutes and then call the ToString() method of the object.
What is the best way to approach this task?
Hello Burak,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I copied the default Style of the SummaryRowCellControl and changed the Binding in the Template. Now it point directly to the SummaryResult’s Value and since I return an object, the ToString method is called. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
Thank you for the answer, Stefan.With your help, I was able to display the summaries. However, I couldn't solve some issues with the data and formatting.1. If the value of the object (for example a TimeSpan instance) is negative, we display it with red text. We do this formatting in the handler of the InitializeRow event. However, this event handler doesn't have any effect on the summary row. What is the best way to apply the same conditional formatting to the summary row as well?2. Depending on the input data, we can have group by rows or not. If we have group by rows, the summaries are not correct (see attached image). I think the overall summary row takes the sum of the group by rows, which are empty.3. The grid layout is created programmatically, because we don't know the number and content of the columns at the design time. If we have group by rows, we create a second ColumnLayout for the data rows. We set the column width to ColumnWidth.Auto programmatically. However, as you can see from the image, the header, the overall summary, and the data rows have different widths. We need them to have the same width. How can we achieve this?
I have modified the sample I sent you before, so now the summaries have Red foreground. Basically I bound the Foreground to the value and used a Converter. You can put some logic in the Convert method in order to return different colors. As for the summary values when you have groups, I can suggest you check your logic for the summaries. For the third question, I can suggest you see this forum thread, where a similar question is already discussed:
http://ko.infragistics.com/community/forums/p/86323/430556.aspx