This question is locked. New answers and comments are not allowed.
Hi there,
Currently, I'm working on a grid, where use is allowed to change the value of the cell. I have an aggregation function for this column. Everything is fine as long as user doesn't change the value. The aggregate value doesn't seem to change upon user change cell value.
How should I do this, so the aggregated value will get updated upon user change one of the cells' value? By the way, I use a custom aggregate function this case.
xmal
xmal.cs
thank you
regards
Jerry
Currently, I'm working on a grid, where use is allowed to change the value of the cell. I have an aggregation function for this column. Everything is fine as long as user doesn't change the value. The aggregate value doesn't seem to change upon user change cell value.
How should I do this, so the aggregated value will get updated upon user change one of the cells' value? By the way, I use a custom aggregate function this case.
xmal
<
controls:RadGridView
x:Name
=
"ProjectRiskAnswersGridView"
HorizontalAlignment
=
"Stretch"
HorizontalContentAlignment
=
"Stretch"
VerticalAlignment
=
"Top"
VerticalContentAlignment
=
"Stretch"
Grid.Row
=
"1"
ItemsSource
=
"{Binding RiskAnswers, Mode=TwoWay}"
DataLoadMode
=
"Asynchronous"
CanUserDeleteRows
=
"False"
CanUserFreezeColumns
=
"False"
CanUserReorderColumns
=
"False"
CanUserResizeColumns
=
"False"
RowIndicatorVisibility
=
"Collapsed"
IsFilteringAllowed
=
"False"
GridLinesVisibility
=
"None"
ShowGroupPanel
=
"False"
CanUserSortColumns
=
"True"
AutoGenerateColumns
=
"False"
ValidatesOnDataErrors
=
"None"
ShowColumnFooters
=
"true"
SelectionMode
=
"Single"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
UniqueName
=
"RiskAreaColumn"
IsReadOnly
=
"True"
DataMemberBinding
=
"{Binding RiskQuestion.RiskArea.RiskAreaText, Mode=TwoWay, ValidatesOnDataErrors=False}"
Header
=
"Area"
/>
<
telerik:GridViewDataColumn
UniqueName
=
"RiskQuestionColumn"
IsReadOnly
=
"True"
DataMemberBinding
=
"{Binding RiskQuestion.QuestionText, Mode=TwoWay, ValidatesOnDataErrors=False}"
Header
=
"Question"
Width
=
"500"
/>
<
local:RatingColumn
UniqueName
=
"RiskRatingColumn"
IsReadOnly
=
"True"
DataMemberBinding
=
"{Binding Rating, Mode=TwoWay, ValidatesOnDataErrors=False}"
CellTemplate
=
"{StaticResource RatingTemplate}"
Header
=
"Rating"
Width
=
"200"
/>
<
telerik:GridViewDataColumn
UniqueName
=
"RiskPointsColumn"
IsReadOnly
=
"False"
DataMemberBinding
=
"{Binding Point, Mode=TwoWay, ValidatesOnDataErrors=False}"
Header
=
"Points"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
local:TotalPointsFunction
Caption
=
"Total: "
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
</
telerik:RadGridView.Columns
>
</
controls:RadGridView
>
xmal.cs
public class TotalPointsFunction : EnumerableAggregateFunction
{
protected override string AggregateMethodName
{
get { return "TotalPoints"; }
}
protected override Type ExtensionMethodsType
{
get { return typeof(Functions); }
}
}
public static partial class Functions
{
public static int? TotalPoints<
TSource
>(IEnumerable<
object
> source)
{
var totalPoints = source.OfType<
RiskAnswer
>().Aggregate<
RiskAnswer
, int?>(0, (current, riskAnswer) => current + riskAnswer.Point);
return totalPoints;
}
}
thank you
regards
Jerry