How do I detect when a cell's value has changed in Silverlight?

Posted by jvenema on Stack Overflow See other posts from Stack Overflow or by jvenema
Published on 2010-05-13T22:08:24Z Indexed on 2010/05/13 22:14 UTC
Read the original article Hit count: 142

Hey folks,

I'm working in Silverlight, trying to figure out how to set a grid cell font color based on the contents of the cell.

I have an ObservableCollection bound to a DataGrid, and my items implement INotifyPropertyChanged so the grid updates as I change the values; it's all working perfectly, including letting me sort items and keep the sorting while I update the underlying items.

I know I can use the LoadingRow event to change colors, but the only way I can get the event to fire is by changing the grids datasource, in which case my sorting goes out the window.

So, what I really want is a way to either 1) loop the rows in the datagrid, find the cell I need, and change it's color or 2) implement a custom column that I can use to dynamically set the color. The problem is how to actually do either of those things :)

All suggestions welcome.

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about datagrid