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?