Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Changing the style of a row programatically
posted

I have a xamDataGrid wired up to a data source which can have data rows changed or updated within it. This is all working fine and the grid updates and the data changes.

However to indicate to the user that a row has changed I want to change the style of that row to highlight it (the set it back to normal and highlighting the next row that changes).  I assume that I need to apply a style to a particular row but I don't know how to do that - can anyone enlighten me?

Parents
No Data
Reply
  • 2125
    posted

    Hi,

    In answer to your question - "How to highlight a changed(updated) xamDataGrid row and how to restore its previous
    style(background) after changing(updating) another xamDataGrid row ?"
    I would suggest the following solution:

    1. Use the RecordUpdated event of the xamDataGrid

    2. Change the background of  the updated(changed) row through using the DataRecordPresenter

    DataRecordPresenter.FromRecord((Record)e.Record).Background = Brushes.LightGoldenrodYellow;

    3. Keep the DataRecordPresenter reprisenting the updated(changed) record  and the updated(changed) record


    The attached ChangingRowBackgroundProgrammatically sample application contains the full solution implementation.


    Best Regards,
    Yanko

    ChangingRowBackgroundProgrammatically.zip
Children