Hello,
I have a GridView bound to a list of objects. The grid has 2 columns. The first is bound to a property called Amount, and is editable. The second is bound to a property called TotalAllocation and is readonly. The TotalAllocation column has an aggregate function (sum).
The TotalAllocated property is a calculated property that uses the Amount property. So in the Amount property, I raise propertychanged of both Amount and TotalAllocated.
The TotalAllocated column works correctly : when I update the Amount column, it automatically updates the TotalAllocated column with the calculated value. But the TotalAllocated Footer (sum function) does not update. The sum is correct when the grid is first bound, but does NOT update as values update.
Let me know if there is a work around, or if I'm missing something.
Thanks,
Justin
I have a GridView bound to a list of objects. The grid has 2 columns. The first is bound to a property called Amount, and is editable. The second is bound to a property called TotalAllocation and is readonly. The TotalAllocation column has an aggregate function (sum).
<
telerik:GridViewDataColumn
Width
=
"95"
Header
=
"Amount"
DataMemberBinding
=
"{Binding Amount, Mode=TwoWay}"
/>
<
telerik:GridViewDataColumn
Width
=
"135"
Header
=
"Total Allocated"
DataMemberBinding
=
"{Binding TotalAllocated, Mode=OneWay}"
DataFormatString
=
"{}{0:c}"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:SumFunction
Caption
=
"Sum: "
ResultFormatString
=
"{}{0:c}"
SourceField
=
"TotalAllocated"
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
The TotalAllocated property is a calculated property that uses the Amount property. So in the Amount property, I raise propertychanged of both Amount and TotalAllocated.
private
Decimal? _Amount =
null
;
public
Decimal? Amount
{
get
{
return
_Amount; }
set
{
if
(value != _Amount)
{
_Amount = value;
NotifyPropertyChanged(
"Amount"
);
NotifyPropertyChanged(
"TotalAllocated"
);
}
}
}
public Decimal ? TotalAllocated
{
get
{
return (_CostPerUnit.HasValue && _Amount.HasValue) ? _CostPerUnit * _Amount : null ;
}
}
The TotalAllocated column works correctly : when I update the Amount column, it automatically updates the TotalAllocated column with the calculated value. But the TotalAllocated Footer (sum function) does not update. The sum is correct when the grid is first bound, but does NOT update as values update.
Let me know if there is a work around, or if I'm missing something.
Thanks,
Justin