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://ko.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.
I am trying and getting towards what I want. I managed to get the dynamic columns added to the header. phew..!!
Few queries though:
1. The Headers: I want to display the header text of my columns, however, the code suggests use of "key"
<TextBlock Text="{Binding Key}" ... /> which is infact, SummaryDefinition's ColumnKey property.
how to get the actual column headers instead of the key??
2. Summary Header update: My grid is editable. so when user edits the value in one of the cell, the "sum" should get reflected in the Header, which currently not happening. Any clue?
Thanks!
Hi,
Got Solution for the 2nd part: Summary Update:
row.Manager.RefreshSummaries();
refreshes the summary for the selected row.
Putting Column header text (instead of the column key) in the Summary header template is still pending.
Thank you for your feedback. I am glad that you were able to resolve one of your issues, as for the other one I can suggest you see this forum thread:
http://ko.infragistics.com/community/forums/p/75549/381916.aspx
where a similar issue is discussed. Please let me know if this helps you or you need further assistance on this matter.
hi,
nice idea.
however, i dont get my XamGrid object in the Convert method, so i cant do something like
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return value.ToString(); //return (parameter as XamGrid).Columns[value.ToString()].HeaderText; }:
i want to run the commented code somehow.
I tried passing in ConverterParamter={MyXamGridObject}
<TextBlock Text="{Binding Key, Converter={StaticResource CNConverter}, ConverterParameter={StaticResource MyXamGridObject}}" FontSize="11" />
but no luick. :(
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.
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".