控件的两个事件都需要调用这个方法,新增的时候不写CellEditEnded,不然不会生效
ItemsSourceChanged="DetailGrid_ItemsSourceChanged" CellEditEnded="DetailGrid_ItemsSourceChanged"
/// <summary>
/// 列表1合计
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DetailGrid_ItemsSourceChanged(object sender, EventArgs e)
{
var vm = DataContext as PlateReplaceApplyFormVM;
if (vm == null) return;
CfgSaleOrderReviewItem.ColumnFooterRows.Clear();
var gr = new GroupRow()
{
FontWeight = FontWeights.Bold
};
if (vm.SaleOrderList != null && vm.SaleOrderList.Count > 0) {
CfgSaleOrderReviewItem.ColumnFooters.Rows.Add(gr);
gr["ManagerName"] = "合计";
gr["ProductQuantity"] = vm.SaleOrderList == null ? 0 : vm.SaleOrderList.Sum(p => Convert.ToInt32(p.ProductQuantity));
gr["ProductTotalArea"] = vm.SaleOrderList == null ? 0 : vm.SaleOrderList.Sum(p => Convert.ToDouble(p.ProductTotalArea));
}
}