简体   繁体   中英

Applying a style to a DataGridCell based on changed cells in DataTable

I'm looking for an easy approach on indicating in a DataGrid if a DataTable has changes which were not updated in the database, yet.

What I would like to do is for example on cells which have pending changes, change the background color to show the user that he has changed the value for this particular cell and this will be updated once the Update command gets called.

I'm not really clear on how to approach this. Might implementing a custom DataView be the best way to go or map everything to custom objects within an ObservableCollection, which would mean doing the mapping and update manually behind the curtain.

if you're using .Net framework 2.0+, I guess you mean DataGridView instead of DataGrid .

You could change the cell style the DataGridViewCell on the CellValueChanged Event . The DataGridViewCellEventArgs gives you the RowIndex and ColumnIndex in the DataGridView .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM