I have built a DataGrid and have my values displaying. How can I easily have a cell highlight and fade to normal after a value changes?
DataGrid entry highlight on change
Answers approved by DevExpress Support
Hi Bryce,
I would like to clarify one point. The standard DataGrid does not support this functionality, and the approach with Binding.TargetUpdated has many side effects. For example:
- When you scroll rows, cells are highlighted, and data source values are not changed.
- When you change data and start to scroll rows, animation is restarted.
- If you select a row with animation, it's cancelled.
- If you edit data in a grid, the animation is not raised, etc. See the attached screencast.
If you would like to implement the exact same behavior in our GridControl, it's not a problem. The question is whether users will like it, because the animation on Binding.TargetUpdated has nothing to do with "animation for modified cells". The only approach to achieve this goal is to implement an additional field that will signal whether the field was modified as Michael has shown.
In any case, if you wish to implement the exact same appearance as the Binding.TargetUpdated, drop me a line. I will prepare a sample for you.
Updated
An easier solution would be to use an approach similar to the one demonstrated in the A general approach to highlighting specific grid cells example. Please check the attached sample project to learn more.
The attached example itself doesnt work properly. If you run it up and then scroll quickly you can clearly see animations occurring even in cells which have not been updated (ie. showing their orignal data). Its slightly better than using TargetUpdated where numerous unedited cells flash upon scrolling, but its still far from ideal.
Its astonishing that there is no easy, or even guaranteed, way to get a cell to flash when its data changed (and not when it hasnt) - something that was trivial in Winforms.
Hi James,
We need some additional time to research this and find the most appropriate solution. Please stay tuned.
Hi James,
I have modified the sample so that it now doesn't show animation for non-modified cells. Please find it in the attached archive.
Hi Bryce,
You can find the general approach of embedding animation into GridControl cells in the E1532: How to embed animation into grid cells example.
Would you please clarify one detail: should the animation be activated when a cell value is modified by a user or when the GridControl's underlying data is changed in code?
Thanks,
Alexander
Hi Alexander,
I am wanting to highlight a sell when the underlying data is changed in the code.
Thanks,
Bryce
Hi,
The following examples demonstrate how to highlight modified rows, cells:
Please review them and let us know whether or not they meet your requirements.
Thanks,
Michael
Hello Support,
My frustration level is off of the charts :-(. Given the examples, documentation, and a working Wpf.Grid + ViewModel, I could NOT get the DXGrid to work!#@!! I assume it is my lack of detailed understanding:-( I have attached the DxGrid code as Confused.txt. I need to do 2 different behaviors (2 different templates). The first behavior is a cell that will display the Theme Background when the cell is unchanged, then when the cell is TargetUpdated, it runs the Storyboard in the Resources section to change the background color to OrangeRed and after 10 seconds fade back to normal Theme. The second behavior is to display unchanged cells normal Theme Background and TargetUpdated cells OrangeRed where the color will stay constant. Your help will be greatly appreciated and much needed.
Regards,
Bryce
Hello Support,
I thought you might want to see my normal grid that does the color fading behavior. Both views are currently attached to the same ViewModel until I get the DxGrid to function. At that point I will eliminate the Wpf.Grid.
Bryce
Hi Bryce,
We are working on your sample and will get back to you as soon as we have any results. We appreciate your patience.
Hello Ivan,
Thank you for the feedback.
Bryce
Hello Bryce,
In the GridControl implementation, the NotifyOnTargetUpdated property isn't specified for cell bindings (Flash GridControl Cell on value changed?). Therefore, to animate a newly updated cell in a read-only GridControl, I suggest you store information about modified cells and based on this info, highlight cells.The easiest way to store information in the GridControl in ReadOnly mode is to create an additional property at the data object level (as Vito suggested in How to make every cell flashes when the displayed value changes). I have created a sample project that illustrates this approach in action.
Thanks,
Michael
Hello Support/Michael,
While the example code works, it is very UGLY and highly error prone. I have so many tables with so many fields, that this is NOT a workable solution. I must say I am shocked that the standard DataGrid supports this feature and the DxGrid does not. Clearly from the pointers you provided, I am not the only customer who has asked for this feature. What other alternatives can you suggest?
Bryce