I created a WPF app that is bound to a data source that will need to be updated. I've basically raised the DataValueChanged event with a value history of 2 and comparing both values. If the cell data value has changed, I'm changing the background color of the cell. This seems to work perfectly up until column sorting. Is there a way to have the cellValuePresenter retain its set brush property if the column gets sorted? The only way I could think of is to tag the brush object every time the value is changed and raise a new event to refresh the background colors on sorting.
TIA
If you're using the DataValueChanged functionality for a field then the new InitializeCellValuePresenter event will also be raised for cells in that field. You probably want to have logic in that event that will initialize the background, etc.
I think both solutions could work but what i can't figure out is how the binding can work on ValueHistory given the CellPresenter's data is either virtualized or recycled anytime the cell is out of scope? In other words, if a cell has a certain value in it, it's retained in the history. Once that cell moves out of scope on the screen then the value that is currently in it's viewable position gets added to its history as well. Therefore, as long as the cell stays in a viewable area or as long as the ContainerGenerationMode is set to PreLoad will it guarantee it's history for binding. Is that right?
The value changed history is either stored by the CellValuePresenter or by the Cell itself depending upon the FieldSettings->DataValueChangedScope. If you want to maintain the history regardless of whether the cell is in view then you could set that property to AllAllocatedRecords. Note: this adds more overhead since the history needs to be maintained/tracked for all cells in that field.