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
The problem is how to actually do either of those things :).
You should use databinding for this.
See here for a good example
http://weblogs.asp.net/joewrobel/archive/2009/01/25/conditional-formatting-in-the-silverlight-datagrid.aspx