Hello,
I have a XamDataGrid with fields/columns A, B and C. A and B are using summary definitions each with the default "Sum"-summary calculator set. For C I defined a third summary definition with a custom summary calculator where in the EndCalculation event I'am calculating a percentage value depending on the summaries A and B. The problem is, that I only can set one field as SourceFieldName per summary definition which I set to field C for the custom summary calculator. Now the EndCalculation event is just fired on changes of cells in field C. But I need it to be fired on changes of the cells in column A and B or just on their summary changes. How can I achieve this?
I have been looking into your issue and it seems that there is no specific event for summary changing. I can suggest you handle the ‘LayoutUpdated’ event of the XamDataGrid and refresh the summaries into it like e.g. :
private void xamDataGrid_LayoutUpdated(object sender, EventArgs e)
{
if( xamDataGrid.FieldLayouts[0].SummaryDefinitions.Count != 0)
xamDataGrid.FieldLayouts[0].SummaryDefinitions[0].Refresh();
}
I hope this will help you.
I don't know which event I should use. I think using record update will be called to often and could result in performance issues because we have a big data grid.
Is there maybe a summary changed event or anything similar? I'm thinking of catching the summary changed event of column A and B and recalling summary calculator of column C (which shows the result) manually in it. Would that be possible and if so, do have another sample for me?
You can use some other event like e.g. RecordUpdate. I am not sure how exactly your data in the XamDatagrid changes.
The problem is that our grid is much more complex and values are sometimes getting calculated by XamCalculationManager and are not always entered by user.
I have been looking into this issue and I can suggest you handle the ‘EditModeEnded’ event of the XamDataGrid and refresh the summary definition like e.g. :
private void xamDataGrid_EditModeEnded(object sender, Infragistics.Windows.DataPresenter.Events.EditModeEndedEventArgs e)
If you have any other question on this matter, feel free to ask.