Hi,
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:
XAML:
Business Object (bound to grid as List<SummaryItem> instance)
Custom functions (ignore the "return null" bit):
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,
Chris.
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:
XAML:
<
telerik:RadGridView
x:Name
=
"summaryView"
ItemsSource
=
"{Binding Data}"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Area"
DataMemberBinding
=
"{Binding AreaName}"
IsVisible
=
"False"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:CountFunction
Caption
=
"Total Indicators:"
/>
<
local:SummaryGridCountOnTargetFunction
Caption
=
"Total On Target:"
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
etc
<
telerik:RadGridView.GroupDescriptors
>
<
telerik:GroupDescriptor
Member
=
"AreaName"
SortDirection
=
"Ascending"
/>
</
telerik:RadGridView.GroupDescriptors
>
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
{
get
{
return
"OnTarget"
;
}
}
protected
override
Type ExtensionMethodsType
{
get
{
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,
Chris.