I have a context menu item that switches the summary row on and off. I've implemented it via the following:
this.MyXamGrid.SummaryRowSettings.AllowSummaryRow = this.ShowGeneralTotals? SummaryRowLocation.Bottom : SummaryRowLocation.None;
I have a few question related to this.
1. However, when I switch the summary row on, I see the sigma sign on the header. I need to switch the sigma sign off. So that it shouldn't be displayed and the user shouldn't be able to interact with this.
2. In the summary row, I only need to see the total of the column, only the number without any text.
3. When the grouping is switched on, in addition to the summary row of the overall grid, I need a summary row for each group. We were able to implement this in UltraGrid (WinForms) with the enum SummaryDisplayAreas. However, SummaryRowLocation doesn't have similar values.
Are these items feasible to implement in XamGrid? What is the best way to approach each item?
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 HeaderCellControl and commented the Summary button. I also set the SummaryDisplayTemplate of the SummaryRowCellControl and removed the text and the “=”. As for the summary in each group, I can say that this is the default behavior of the XamGrid. Please let me know if you need further clarifications on this matter.
Looking forward for your reply.
Hello Stefaan,
Thank you for your reply. I have included your code in my solution.
Hiding the sigma sign worked for most of the columns, but the styles of some headers are overridden in the code (cs file). For those columns, I still see the sigma sign.
In order to overcome this, I tried the following:
private const string __HeaderDropDownControlTemplate = //"<igPrim:HeaderDropDownControl AllowResizing=\"true\" x:Name=\"FilterHeaderDropDownControl\" Visibility=\"Collapsed\" Background=\"Transparent\" Grid.Column=\"2\">" + //"<igPrim:HeaderDropDownControl.OpenButtonContent>" + "<Grid Width=\"11\" Height=\"8\">" + "<Path" + "x:Name=\"clearFilterGlyphStroke\"" + "Width=\"11\"" + "Height=\"8\"" + "HorizontalAlignment=\"Center\"" + "VerticalAlignment=\"Center\"" + "Data=\"M 0,0 C0,0 11,0 11,0 11,0 7,4 7,4 7,4 7,8 7,8 7,8 4,8 4,8 4,8 4,4 4,4 4,4 0,0 0,0 z\"" + "Fill=\"{StaticResource HeaderCellGlyphBrush}\"" + "Stretch=\"Fill\"/>" + "<Path" + "x:Name=\"clearFilterGlyphFill\"" + "Width=\"7\"" + "Height=\"6\"" + "HorizontalAlignment=\"Center\"" + "VerticalAlignment=\"Center\"" + "Data=\"M 0,0 C0,0 7,0 7,0 7,0 4,3 4,3 4,3 4,6 4,6 4,6 3,6 3,6 3,6 3,3 3,3 3,3 0,0 0,0 z\"" + "Fill=\"#FFFFFFFF\"" + "Stretch=\"Fill\"/>" + "<Path" + "x:Name=\"redFilterGlyphFill\"" + "Width=\"7\"" + "Height=\"6\"" + "HorizontalAlignment=\"Center\"" + "VerticalAlignment=\"Center\"" + "Data=\"M 0,0 C0,0 7,0 7,0 7,0 4,3 4,3 4,3 4,6 4,6 4,6 3,6 3,6 3,6 3,3 3,3 3,3 0,0 0,0 z\"" + "Fill=\"{StaticResource FocusBrush}\"" + "Stretch=\"Fill\"" + "Visibility=\"Collapsed\"" + "/>" + "</Grid>"; // + //"</igPrim:HeaderDropDownControl.OpenButtonContent>" + //"<igPrim:FilterSelectorControl Height=\"370\" Width=\"250\" MinWidth=\"250\" MinHeight=\"370\" HorizontalContentAlignment=\"Stretch\" VerticalContentAlignment=\"Stretch\" Cell=\"{Binding Path=Cell,RelativeSource={RelativeSource TemplatedParent}}\"></igPrim:FilterSelectorControl>" + //"</igPrim:HeaderDropDownControl>";
Then in a method:
var headerTemplate = string.Format(__RegisterHeaderTemplate, text, fontSize); column.HeaderTemplate = (DataTemplate)XamlReader.Load(headerTemplate); var overrideStyle = new Style(typeof(HeaderCellControl)); overrideStyle.Setters.Add(new Setter(HeaderCellControl.MarginProperty, "0")); overrideStyle.Setters.Add(new Setter(HeaderCellControl.PaddingProperty, "0,0"));
// line added by me: overrideStyle.Setters.Add(new Setter(HeaderDropDownControl.OpenButtonContentProperty, __HeaderDropDownControlTemplate)); column.HeaderStyle = overrideStyle;
This did not have the impact I wanted. So, I want to use a technique similar to the one above and address the issue in the viewmodel side.
Can you suggest a solution where I can make this partial modifications via Setters in the cs side?
I am glad that you were able to resolve your issues. As for the summary position, I can say that currently you are not able to control it, so I can suggest you log this as a new product idea here:
http://ideas.infragistics.com/
Please let me know if you need further clarifications on this matter.
Thank you for the answer Stefan. That solves the first two items in my first post.
"As for the summary in each group, I can say that this is the default behavior of the XamGrid."
Is there a possibility to switch on and off the summaries per groups and summary over the whole grid independently?
This is possible in UltraGrid.
Show only the summaries for the whole grid: SummaryDisplayAreas.Bottom. Only for the GroupByRows: SummaryDisplayAreas.GroupByRowsFooter. For both: SummaryDisplayAreas.Bottom | SummaryDisplayAreas.GroupByRowsFooter.
I can suggest you set the BasedOn Property of the Styles you apply in code to the one I gave you. You can get the Style from the XAML like this:
e.Cell.Column.HeaderStyle = new Style(typeof(HeaderCellControl)) { BasedOn = LayoutRoot.Resources[typeof(HeaderCellControl)] as Style };
Please let me know if this helps you or you need further assistance on this matter.