Hi, I've a complicated requirement for Xamgrid grouping and summary row:
I've below data:
Store,Product,SizeS,SizeM,SizeL
s1, p1, 1,2,3
s1, p2, 3,2,4
s2, p1, 4,5,3
s2, p2, 7,5,3
now, I want to show this data in xamgrid with summary & group.
I grouped the data on Store, so, it looks like (expanded):
v s1
v s2
But, I want it to be shown like:
store, sizeS, sizeM, SizeL
>s1, 4,4,7
>s2, 11,10,6
(notice, the figures are Sum of sizes)
here ">" show its expandable. and upon expanding first store:
v s1, 4, 4, 7
product, sizeS, SizeM, SizeL
p1, 1,2,3
p2, 3,2,4
Any pointers, pls??
Hello Vijay,
Thank you for your post. I have been looking into it and I can suggest you see this sample from our online Samples Browser:
http://es.infragistics.com/products/silverlight/sample/grid/#/summary-row-in-groupby-headers
where it is shown how to achieve the functionality you want. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Hi Stefan,
Thanks for the reply.
I've seen that example before and found that it's the "closest match" to my requirement.
However, to use that, i guess i need to specify "<ig:TextColumn.GroupByItemTemplate>" and I see 3 problems with that :
1. i've to write xaml for each column that i want to display, with width and all. i've somany columns to be displayed
2. since it's not a proper xamgrid column header/row, so, it can not be sorted etc. (i dont have the grouped column indicator displayed on top).
3. i've dynamic columns as well. so, i dont know if this approach work with dynamic column or not.
Do we have any sample ready for this feature, where i can run and play with?
thanks again.
Hi Stephan,
Thanks for the link. I had gone thru the page and managed to achieve most of the functionality for my requirement.
However, the example you mentioned and the referred thread post uses the column "key" as the the display labels in the summary row.
Another thread post suggests to use Converter, which works fine, unless one want to access the same xamgrid in the "Convert" method - to fetch the actual rendered column headers text from the xamgrid, with the help of available column keys in the Convert function.
I couldnt get reference to my XamGrid in the Convert function of the Converter class, even with "ConverterParameter".
I am still struggling with it.
I even tried having a static data holder class, but then it fails when I've multiple of such instances.
Did you managed to think about it?
Thanks.
I have modified the sample from the referred forum thread, so now it has the functionality you want. Basically I used MultiBinding for the TextBlock’s text and bound it to the Column’s Key and the XamGrid itself. I also used a MultiConverter to return the Column’s HeaderText. Please let me know if this helps you or you need further assistance on this matter.
hi Stefan,
Thanks for the solution.
However, I achieved it a little differently:
My Xaml looks like:
<TextBlock Loaded="tbSumHead_Loaded" />
My Code look like:
..
ColumnNameConverter myConverter = new ColumnNameConverter(mygrid);
private void tbSumHead_Loaded(object sender, RoutedEventArgs e) { (sender as TextBlock).SetBinding(TextBlock.TextProperty, new System.Windows.Data.Binding("Key") { Converter = myConverter }); }
This has solved my problem. Please comment on my approach.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.