I want to show only one of the Aggregate function define in the columns.
Column One
Aggregate define
Count
Column Two
Aggregate define
SUM
AVERAGE
Column Three
Aggregate define
SUM
AVERAGE
In the Group Header I only want the Count Function. Not all aggregates.
Does some one can help me please?
4 Answers, 1 is accepted
I have spent some time to research your case in order to find any way to achieve this result. Regarding the template structure and the internal logic of the GridViewGroupRow you cannot predefine this behavior in such manner. If you take a look at the default template of GridViewGroupRow you can see the element AggregateResulsList, which displays the results of the aggregate functions. This part internally handles the aggregates and there is no way to "instruct" it to display only the first function in the header and to ignore the rest. However you may hide all aggregates by creating a simple style targeted at GridViewGroupRow and set ShowHeaderAggregates property to False, as shown below:
<
Style
TargetType
=
"{x:Type telerik:GridViewGroupRow}"
>
<
Setter
Property
=
"ShowHeaderAggregates"
Value
=
"False"
/>
</
Style
>
Best wishes,
Vanya Pavlova
the Telerik team

Thank you for your answer, but it doesn't help me :)
If I don't show all of the aggregate (ShowHeaderAggregates=False) result on the group header. Is it possible to show an aggregate (Items count) without define it in the columns ?
Thank you
If the main goal is to just show the total item count in RadgridView in GridViewGroupRow's Header you may predefine it on a RadGridView level and bind a single TextBlock to the count of the items, please refer to the following mark-up:
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
DataContext
=
"{Binding Source={StaticResource SampleDataSource}}"
>
<
Grid.Resources
>
<
Style
x:Key
=
"groupRowStyle"
TargetType
=
"telerik:GridViewGroupRow"
>
<
Setter
Property
=
"ShowHeaderAggregates"
Value
=
"False"
/>
</
Style
>
</
Grid.Resources
>
<
telerik:RadGridView
x:Name
=
"gridView"
GroupRowStyle
=
"{StaticResource groupRowStyle}"
ItemsSource
=
"{Binding Collection}"
>
<
telerik:RadGridView.GroupHeaderTemplate
>
<
DataTemplate
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"RadGridView's ItemCount: "
/>
<
TextBlock
Text
=
"{Binding Items.Count,ElementName=gridView}"
/>
</
StackPanel
>
</
DataTemplate
>
</
telerik:RadGridView.GroupHeaderTemplate
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"P1"
DataMemberBinding
=
"{Binding Property1,Mode=TwoWay}"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:CountFunction
Caption
=
"Total: "
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"P1"
DataMemberBinding
=
"{Binding Property2,Mode=TwoWay}"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:CountFunction
Caption
=
"Total: "
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"P1"
DataMemberBinding
=
"{Binding Property3,Mode=TwoWay}"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:CountFunction
Caption
=
"Total: "
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
Please let me know how this works for you!
Best wishes,
Vanya Pavlova
the Telerik team

Great. But i use the property Group.ItemsCount for items count in group.
Thank You