Cross-Column Custom Aggregation under non-numeric column

1 posts, 0 answers
  1. Chris
    Chris avatar
    9 posts
    Member since:
    Sep 2011

    Posted 24 Oct 2011 Link to this post


    Could you clarify how to implement custom aggregation under any column group across multiple columns in a grid view that is bound to a collection of business objects?

    I have tried to follow this sample but I get the following error:

    No generic method 'OnTarget' on type 'Blah.SummaryGridCounter' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic.

    Here are the parts of my code:
            <telerik:RadGridView x:Name="summaryView"
                                  ItemsSource="{Binding Data}">
                    <telerik:GridViewDataColumn Header="Area" DataMemberBinding="{Binding AreaName}" IsVisible="False">
                            <telerik:CountFunction Caption="Total Indicators:" />
                            <local:SummaryGridCountOnTargetFunction Caption="Total On Target:"/>
        <telerik:GroupDescriptor Member="AreaName" SortDirection="Ascending"   />

    Business Object (bound to grid as List<SummaryItem> instance)
    public class SummaryItem
        public string AreaName { get; set; }
        public string IndicatorName { get; set; }
        public List<SomeComplexType> Metrics { get; set; }

    Custom functions (ignore the "return null" bit):
        public class SummaryGridCountOnTargetFunction : EnumerableSelectorAggregateFunction
            protected override string AggregateMethodName
                    return "OnTarget";
            protected override Type ExtensionMethodsType
                    return typeof(SummaryGridCounter);
        public static class SummaryGridCounter
            public static object OnTarget<TSource>(IEnumerable<TSource> source, Func<TSource, object> selector)
                return null;

    I have read in other posts that the signature of SummaryGridCounter may need to change but I have tried various signatures including double, int, SummaryItem, string etc and have had no luck.

    I'm grouping on a hidden string column, but want to display numeric aggregate data (and maybe text too with a seperate function) in the group header for the column based on the contents of the SummaryItem object to which the rows are bound.

    Thanks for any help,
Back to Top