BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
<syncfusion:GridDataUnboundVisibleColumn Expression="price*used" HeaderText="What if Cost"
MappingName="cost2" IsReadOnly="True">
i edit the price from say 10.00 to 12.00 and i get the correct new total cost in my unbound column.
Example
price used total price
10.00 5 50.00
edit price to 12.00
12.00 5 60.00 this works OK.
But the summary row does not update to reflect the new overall total cost (ie sum of the unbound column values.)
My data is in an observable collection which i set to the grid itemsource at load time.
i have tried using doubleaggregate and customaggregate to get the summary row to update but it does not update.
i hope i am missing something simple here.
regards
Bruce
this.dataGrid.ItemsSourceChanged += dataGrid_ItemsSourceChanged; void dataGrid_ItemsSourceChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args) { this.dataGrid.Model.View.RecordPropertyChanged += View_RecordPropertyChanged; } void View_RecordPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var updatetablesummarymethod = this.dataGrid.Model.View.GetType().GetMethods(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).FirstOrDefault(methodinfo=> methodinfo.Name == "UpdateTableSummary" && methodinfo.GetParameters().Count() == 0); updatetablesummarymethod.Invoke(this.dataGrid.Model.View, null); } |
dataGrid6.ItemsSourceChanged += dataGrid6_ItemsSourceChanged;
dataGrid6.Model.View.RecordPropertyChanged += View_RecordPropertyChanged;
public class Chemical_Data
{
public string wellID { set; get; }
public string name { set; get; }
public string function { set; get; }
public double price { set; get; }
public double price2 { set; get; }
//public double stock { set; get; }
public double usedInt { set; get; }
public double usedWell { set; get; }
public double costInt { set; get; }
public double costWell { set; get; }
public double costWell2 { set; get; }
//public double conc { set; get; }
public DataTable dtIntDetails { set; get; }
}
public class Chemical : ObservableCollection<Chemical_Data>
{
public Chemical()
{
Chemical_Data chemical = new Chemical_Data();
}
}
this.dataGrid.ItemsSourceChanged += dataGrid_ItemsSourceChanged;
void dataGrid_ItemsSourceChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)
{
this.dataGrid.Model.View.RecordPropertyChanged += View_RecordPropertyChanged;
}
void View_RecordPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
var recordentry = this.dataGrid.Model.View.Records.GetRecord(sender);
if(recordentry.Parent is Group)
this.dataGrid.Model.View.TopLevelGroup.UpdateSummaries(recordentry.Parent as Group);
} |
var recordentry = this.dataGrid.Model.View.Records.GetRecord(sender); returns null as i have to put it in the Edit cell completed function.
private void dataGrid6_CurrentCellEditingComplete(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs arg
{
var recordentry = this.dataGrid6.Model.View.Records.GetRecord(sender); ----- in my example this returns null........ sender is a GridDataControl
if (recordentry.Parent is Group)
this.dataGrid6.Model.View.TopLevelGroup.UpdateSummaries(recordentry.Parent as Group);
maybe i need to change my observablecollection but i do not what to change it with to allow the capture of the ItemSourceChanged Event.
Regards
Bruce
this.dataGrid.ItemsSourceChanged += dataGrid_ItemsSourceChanged; this.Loaded += MainWindow_Loaded; void MainWindow_Loaded(object sender, RoutedEventArgs e) { if (!iseventwired && this.dataGrid.Model.View != null) { this.dataGrid.Model.View.RecordPropertyChanged += View_RecordPropertyChanged; iseventwired = true; } } bool iseventwired = false; void dataGrid_ItemsSourceChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args) { if (!iseventwired && this.dataGrid.Model.View != null) { this.dataGrid.Model.View.RecordPropertyChanged += View_RecordPropertyChanged; iseventwired = true; } } void View_RecordPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { //Here sender is underlying data object. var recordentry = this.dataGrid.Model.View.Records.GetRecord(sender); if (recordentry != null && recordentry.Parent is Group) { this.dataGrid.Model.View.TopLevelGroup.UpdateSummaries(recordentry.Parent as Group); } } |