This is a migrated thread and some comments may be shown as answers.

grouping and aggregates

1 Answer 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rayne
Top achievements
Rank 1
Rayne asked on 23 Feb 2012, 03:26 PM
I've got a grid that has a group descriptor defined in xaml. I've also added an aggregate to the column that is being grouped to show the count. When the grid loads, the aggregate isn't showing up in the group header. Only when I ungroup, then group again does it show the aggregate. Here is my xaml...stripped for brevity.

<telerik:RadGridView AutoExpandGroups="True" AutoGenerateColumns="False" x:Name="UserGrid"
      ShowInsertRow="False" SelectionMode="Single" IsReadOnly="True" ItemsSource="{Binding AllUsers}" >
      <telerik:RadGridView.GroupDescriptors>
          <telerik:GroupDescriptor Member="Division.Name" SortDirection="Ascending" DisplayContent="Division" />
      </telerik:RadGridView.GroupDescriptors>
        <telerik:RadGridView.GroupHeaderTemplate>
             <DataTemplate>
                 <TextBlock Text="{Binding Group.Key}" FontWeight="Bold" MinWidth="100" />
             </DataTemplate>
        </telerik:RadGridView.GroupHeaderTemplate>
      <telerik:RadGridView.Columns>
          <telerik:GridViewDataColumn DataMemberBinding="{Binding LastName}" Header="Last Name" IsGroupable="False" />
          <telerik:GridViewDataColumn DataMemberBinding="{Binding FirstName}" Header="First Name" IsGroupable="False" />
          <telerik:GridViewDataColumn DataMemberBinding="{Binding Division.Name}" Header="Division">
             <telerik:GridViewDataColumn.AggregateFunctions>
               <telerik:CountFunction Caption="Count:" />
             </telerik:GridViewDataColumn.AggregateFunctions>
          </telerik:GridViewDataColumn>
          <telerik:GridViewDataColumn DataMemberBinding="{Binding Active}" Header="Active" />
          <telerik:GridViewDataColumn DataMemberBinding="{Binding EmailAddress}" Header="Email" IsGroupable="False" CellTemplateSelector="{StaticResource EmailTemplateSelector}" />                   
       </telerik:RadGridView.Columns>
</telerik:RadGridView>

1 Answer, 1 is accepted

Sort by
0
Rayne
Top achievements
Rank 1
answered on 23 Feb 2012, 04:23 PM
Finally figured out that I have to define the aggregate in both the group descriptor and the column. I would have thought just putting it on the column would work.
Tags
GridView
Asked by
Rayne
Top achievements
Rank 1
Answers by
Rayne
Top achievements
Rank 1
Share this question
or