I have a datagrid with the following SummaryDefinition
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:FieldLayout.SummaryDefinitions>
<igDP:SummaryDefinition Key="idp_count" SourceFieldName="IsSelected" Calculator="Sum" StringFormat="{}{0}"/>
now, all this is doing is trying to get the count of the selected items... So in my grid, i have a list with check boxes, and each time i check one, i want the count at the bottom to go up... works great, but its always one off...
for instance... load the grid, sum=0, check first box, sum=0, check second box sum=1, check third sum=2. Now, once i get out of the grid, it updates to the correct sum, but not until i get out. Is there any way to force this to update properly in an event handler?
this.MyGrid.SummaryResultChanged += delegate(object sender, Infragistics.Windows.DataPresenter.Events.SummaryResultChangedEventArgs e) { foreach (SummaryResult result in e.SummaryResult.ParentCollection) { result.Refresh(); } };
What if I need to update the summary for two columns based on the update from one.
Let me explain further - I have an amount and a percentage. The total amount for all rows should remain static. So - when the user increases an amount in one row, the summary amount increases and shows that they now have a total amount greater than what the static total amount SHOULD be. I handle PropertyChanged events to update the corresponding percentage based on the amount. This is reflected on the grid. However, the summary percentage does NOT reflect the updated change.
Is there a way to programmaticly force the summary to update? It seems as though this could be a bug. If the grid can reflect programmatic updates, shouldn't the summary then be updated automatically? Only handling the lost focus event doesn't seem like enough.
This is the default behavior of the grid because the summaries are updated right after the cells lost focus. You can test this by checking the first checkbox and click in a cell in the other column. One way to update the summaries is to handle some of the events that the editor is using like ValueChanged and force the cell to exit edit mode. You may also find this article helpfull.
Hope this helps