Hi,
I have a GridView with a GridViewCheckBoxColumn that is bound to a 'IsSelected' property of an entity.
<
telerik:GridViewCheckBoxColumn
Header
=
""
DataMemberBinding
=
"{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
AutoSelectOnEdit
=
"True"
EditTriggers
=
"CellClick"
>
The entity also has a property 'NetLength'. The entities are grouped by some other property. Each time an entity gets checekd or unchecked, I need to calculate the sum of NetLength. I've done that by adding a custom aggregate funcion in code behind.
var selectedItemsTotalMetersfunction = new AggregateFunction<
PartNumberModel
, decimal>();
selectedItemsTotalMetersfunction.AggregationExpression = pnrs => pnrs.Where(pn => pn.IsSelected).Sum(pn => pn.NetLength ?? 0);
selectedItemsTotalMetersfunction.Caption = "Meters:";
grdShippingOrder.Columns["NetLength"].AggregateFunctions.Add(selectedItemsTotalMetersfunction);
Now, all this works fine except for the fact that the bounded property 'IsSelected' only gets changed when the row changes. Also my total of NetLength is recalculated only when row changes. How can I force the calculation to be done at the moment the checkbox is checked/unchecked ?
In Winforms, the GridViewCheckBoxColumn has a property 'EditMode' which can be set to 'OnValueChange'. Is there something similar in WPF ?
Regards,
Hans