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 feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
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.
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.
Looking forward for your reply.
Hi Stephan,
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 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".