My grid contains a GroupColumn containing 3 editable value-columns and 1 readonly unbound summary-column which value is calculated by a ValueConverter:
The Sum column won't be recalculated if one of the 3 values change, thus I tried to use the ActiveCellChanged event to access the Sum-cell and call a Refresh() from there.
Since I wasn't able to access the Sum-cell I was wondering, if there is an easy way to recalculate the Sum-column?
You can access the unbound cell via the row's cellscollection and call the .Refresh off that
private void grid_CellExitedEditMode
(object sender, Infragistics.Controls.Grids.CellExitedEditingEventArgs e) { ((UnboundCell)e.Cell.Row.Cells[ (UnboundColumn)grid.Columns.AllColumns["xxx"] ]).Refresh(); }
You would not be able to access the cell via the key value. You could use the actual column object and
find it using that.
- Edit -
Just typing it out a different way so that I know its visible
UnboundColumn uc = (UnboundColumn)grid.Columns.AllColumns["XXX"];
UnboundCell cell = (UnboundCell)e.Cell.Row.Cells[uc];
cell.Refresh()
Hi Darrell
Thanks a lot! This seems to work so far and the calculated cell contains the correct value.
But unfortunately the refresh method doesn't update the value in the grid. Do you have another idea?
Attached is a sample app that will change the value of the unbound column when you edit one of the bound columns.
You will need to add the XamGrid and Shared dlls into this project for it to work.
Please modify it to show your issue.
Thanks again!
My datasource is an ObservableCollection, thus the INotifyPropertyChanged should not be the problem. Anyway, I started your app and run in the same problem again:
I'm using version 10.3. Should I try to apply a service release?
Hi,
There was a bug with Refresh in UnboundColumn at some point, so upgrading to the latest SR could work.
As for using an ObservableCollection, that doesn't mean you've implemented INotifyPropertyChanged. It just means you've got a collection that implements INotifyCollectionChanged. What that means is that if you add or remove an item from your collection, the xamGrid will update. However, if you modify a property in your underlying data, it won't update unless that data object implements INPC.
-SteveZ
Hey Steve,
Thanks for your explanation.
The calculation works now after installing the latest Service Release.
Cheers, hoschi