http://blogs.infragistics.com/wpf/articles/creating-a-custom-summary-for-the-xamdatagrid.aspx
My first question is about this line of code in the above cited article:
SummaryCalculator.Register(Summary);
The article cited above says
"This can be achieved by not registering our summary like demonstrated above, but by associating a specific summary definition with a given column:"
"..the developer may want to show their custom summary on a specific field without placing it on every column. "
Emphisis on "not" and "every" is mine...........The article implies that there are two mutually exclusive methods for registering the summaries class ( second method cited in q2 below). When I follow the example I see no summaries at all however the second line quoted above leads me to think that following the example should not have the effect of doing nothing, but should instead display summaries on every column. Question: So when we do register the summary as shown in the article, what is accomplished? Is there additional code that needs to be added to make the article useful, or perhaps some xaml that is expected?
Question 2:
When i use this code I am able to get a summary row to display:
SummaryDefinition myTopSalesPersonFormula = new SummaryDefinition(); myTopSalesPersonFormula.SourceFieldName = "SalesYTD"; myTopSalesPersonFormula.Calculator = Summary; this.xamDataGrid1.FieldLayouts[0].SummaryDefinitions.Add(myTopSalesPersonFormula);
However, unlike the example, I get two rows of totals. I really only need one row, how do I remove the second row? I assume the second row is a subtotal row but I dont know that for sure and when I search for subtotals I find nothing relevent.
Question 3:
My specific question is how to remove the equal sign in front of the displayed total..... but more generally I would like to know what xaml (if any) is required to work with the code behind that is shown in the article. When I use the xaml that is shown in the feature explorer i.e.
<igDP:SummaryDefinition Key="Coupon" SourceFieldName="Coupon" Calculator="Sum">
I get yet a third row of of totals..................
Hello Sam,
Thank you for your post. I have been looking through it and I suggest you look through this forum thread:
http://community.infragistics.com/forums/p/57501/293454.aspx
where there is a sample project showing the implementation of a custom Summary calculator. You can also see here:
http://help.infragistics.com/NetAdvantage/WPF/2011.1/CLR4.0/?page=xamDataPresenter_Creating_a_Custom_Summary_Calculator.html
where it is described step by step how to do so. Please let me know if this helps you, if not, you can send me an isolated sample project and I will investigate it further for you.
Looking forward for your reply.
Thank you Sefan, Would you kindly address questions 1 and 2 above (most importantly #2)?
Regards,
Sam
Hello,
I am just checking the progress of this issue. Please let me know if I can provide you any further assistance.
I have tried to remove pretty much everything from the usercontrol, but still only get the default summary. There has to be something in our toolkit that is causing the problem. Can you give me any hints. Maybe if I override a style so I do not get the default, but I need to know what the name of the style is.
Help would be very much appreciated.
Clifford
There is no way I can modify the sample, since it works fine. I have moved my SummaryCalculator to the sample and it works. I have tried removing allmost all the xaml from my code and it does not work. SInce I depend on a database you will not be able to run the code. I suspect there is some property in our toolkit that is causing the problem, but I do not have ready access to that code. If I have some idea, I can override the property. I can obviously just create a style and then bypass any toolkit effect, but need to know what to override.
Thanks
Could you pelase modify the sample I have sent in my previous post, so it reproduces your behavior, so i could be able to investigate this further for you.
I tried to use the sample to provide a custom format in a class derrived from SummaryCalculator, adn overriding the ApplyDefaultFormat, but still not getting the value from the ApplyDefaultFormat method. The method is called, but seems to have no effect. Any ideas?
I used the code you have provided and I made some changes to the sample project, so now the summary is added only once. Basically I defined an isAdded variable which I set to true, when I add the summary and then in the Load event I check its value. Please let me know if you need further assistance on this matter.