hi,
I did some searching but couldn't find anything that would suit my needs.
What I am looking for is to have summary values displayed in the GroupRow, aligned with its column header as seen in the screenshot below.
I am on version 14.2.
Thank you
Srikar
Hello Srikar,
Thank you for your post.
To have the summaries of a XamDataGrid show up in the group row, aligned with their corresponding columns, I would recommend that you first set the SummaryDisplayArea in the XamDataGrid.FieldSettings to "InGroupByRecords." Next, in the XamDataGrid.FieldLayoutSettings, if you set the GroupBySummaryDisplayMode to "SummaryCellsAlwaysBelowDescription", you will have the summaries be in the group-by records aligned with the columns in the XamDataGrid.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Yes, that works to an extent.
But the "SummaryCellsAlwaysBelowDescription" setting adds a new row below the groupRow to show summaries aligned with column header (as can be seen in the image attached). Not only does this waste space, but also does not look good with large datasets.
Instead, it would be great if you could show me a way to have summaries on groupRow itself (in the redBox or like in the screenshot attached on my 1st post), saving a lot of space.
After researching this, I have come across another forum post which discusses a very similar issue as the one in your most recent response. Here is a link to that forum thread: http://es.infragistics.com/community/forums/t/32301.aspx.
The important part of this forum thread is a sample named WPF_SummariesInGroupedRecord. For your convenience, I have attached a 14.2-convert of that sample to this post. The GroupByRecordPresenter has a StackPanel in its control template that is oriented vertically, and this is what is creating this offset that you are seeing. Inside of this StackPanel, there is a GroupBySummariesPresenter, which shows the summaries. If you put a negative margin or a render transform on this GroupBySummariesPresenter to move it upward, you can place the summaries in line with the header.
Great, seems promising, I will try it out soon and get back to you.
Thanks!
Thanks, this seems to be working. But how viable is this solution, this seems more like a hack. How would the application behave when re-sizing columns/windows/grids?
Also, one more question, can we remove the item count text on groupRow "(x items)"?
I am glad that you were able to resolve this issue you were having.
I found out how to correct this issue.
The itemsControl within SummaryResultsPresenter had Background set to the default theme values. I had to set it to the templatedParent instead.
<Style TargetType="{x:Type igd:SummaryResultsPresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igd:SummaryResultsPresenter}"> <Grid> <ItemsControl x:Name="SummaryItems" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" ItemsSource="{TemplateBinding SummaryResults}" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
Thanks for your help, I was able to implement it the way I need it to be. However, there is a minor issue.
Please take a look at the attached screenshot. I need the SummaryResultPresenter's cell (in red box below) to have the same background as the groupByRow.
[image removed]
And here is the code snippet...
<Style TargetType="{x:Type igd:SummaryResultPresenter}"> <Setter Property="HorizontalAlignment" Value="Right" /> <Setter Property="Template"> <ControlTemplate TargetType="{x:Type igd:SummaryResultPresenter}" > <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Padding="{TemplateBinding Padding}" ToolTip="{Binding Path=SummaryResult.ToolTipResolved, RelativeSource={RelativeSource TemplatedParent}}"> <TextBlock HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Text="{Binding Path=SummaryResult.DisplayTextAsync, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource PrefixRemover}}" />
Just checking in, did you have any other questions or concerns on this matter?
Thank you for your response.
I believe this solution is viable and not really hacky. The Style that you see in the sample project that I sent you is the exact same default style for the GroupByRecordPresenter. The only difference is that a negative margin is added to the GroupBySummariesPresenter to move it up to the same row as the header. I have tried resizing columns and the window without any issues arising.
Regarding removal of the item count on the text that looks like (x items), I would recommend that you add an EventSetter to that style for GroupByRecordPresenter to handle the Loaded event on them. In the event handler, you can set the following code to remove the (x items) item count on the GroupByRecordPresenter:
GroupByRecordPresenter GRP = sender as GroupByRecordPresenter;GRP.Record.Description = ((GroupByRecord)GRP.Record).Value.ToString();
I hope this helps you. Please let me know if you have any other questions or concerns on this matter.