Hi everybody,
I'm struggling for hours using the aggregate functions in my datagrid.
I'm using Telerik RadControls WPF Q2 2012 SP1.
Here is the code:
Xaml:
My collection is a set of objects defined as this:
and the VomRoomStayBreakDown contains this:
Which itself contains this:
Amount is composed of a decimal (Value) and a currency (Currency).
I am trying to Sum the decimal values from my VomAmounts (correctly displayed in the columns), but it always lead to the exception.
"No generic method 'Sum' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic."
Can somebody tells me what I am doing wrong over there ?
Thanks a lot !
I'm struggling for hours using the aggregate functions in my datagrid.
I'm using Telerik RadControls WPF Q2 2012 SP1.
Here is the code:
Xaml:
<
Telerik:RadGridView
x:Name
=
"uxGratuitiesDataGrid"
Margin
=
"-11,-11,-11,0"
Grid.Row
=
"0"
IsReadOnly
=
"True"
CanUserSortColumns
=
"True"
CanUserFreezeColumns
=
"False"
CanUserReorderColumns
=
"False"
AutoExpandGroups
=
"False"
ColumnWidth
=
"*"
AutoGenerateColumns
=
"False"
RowIndicatorVisibility
=
"Collapsed"
ShowGroupPanel
=
"False"
ShowColumnFooters
=
"True"
IsFilteringAllowed
=
"False"
ItemsSource
=
"{Binding SelectedGroupBooking.DailyBreakDown, Source={StaticResource Presenter}}"
>
<
Telerik:RadGridView.Columns
>
<!-- Gratuity amount -->
<
Telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Gratuity.BaseAmount, Converter={StaticResource AmountConverter}, UpdateSourceTrigger=PropertyChanged}"
Header
=
"Base Amount"
>
</
Telerik:GridViewDataColumn
>
<!-- Total Gratuity amount -->
<
Telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Gratuity.TotalAmount, Converter={StaticResource AmountConverter}}"
Header
=
"Total Amount"
>
<
Telerik:GridViewDataColumn.AggregateFunctions
>
<
Telerik:SumFunction
SourceField
=
"Gratuity.TotalAmount"
/>
</
Telerik:GridViewDataColumn.AggregateFunctions
>
</
Telerik:GridViewDataColumn
>
</
Telerik:RadGridView.Columns
>
My collection is a set of objects defined as this:
public
ObservableCollection<VomRoomStayBreakDown> DailyBreakDown
{
get
{
return
_dailyBreakDown; }
set
{ _dailyBreakDown = value; OnPropertyChanged(
"DailyBreakDown"
); }
}
and the VomRoomStayBreakDown contains this:
public
VomGratuity Gratuity
{
get
{
return
_gratuity; }
set
{ _gratuity = value; OnPropertyChanged(
"Gratuity"
); }
}
Which itself contains this:
public
FldInteger Quantity
{
get
{
return
_quantity; }
set
{ _quantity = value; OnPropertyChanged(
"Quantity"
); }
}
public
VomAmount BaseAmount
{
get
{
return
_baseAmount; }
set
{ _baseAmount = value; OnPropertyChanged(
"BaseAmount"
); }
}
public
VomAmount TotalAmount
{
get
{
return
_totalAmount; }
set
{ _totalAmount = value; OnPropertyChanged(
"TotalAmount"
); }
}
Amount is composed of a decimal (Value) and a currency (Currency).
I am trying to Sum the decimal values from my VomAmounts (correctly displayed in the columns), but it always lead to the exception.
"No generic method 'Sum' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic."
Can somebody tells me what I am doing wrong over there ?
Thanks a lot !