So, one more update to this puppy just to let folks know about new information that I found. In my LoadingRow event handler previously, I was setting the variable like this:
DataRowView item = e.Row.Item as DataRowView;
and then checking it's value, only to find that the value of item was never getting updated...
I did some more searching on the internet and found another "solution" that works in the LoadingRow event handler (in addition to the XAML trigger solution I previously posted). So, here's the "new" LoadingRow event handler code:
void dataGrid_LoadingRow(object sender, System.Windows.Controls.DataGridRowEventArgs e)
OptionChain RowDataContext = e.Row.DataContext as OptionChain;
if (RowDataContext != null)
if (RowDataContext.ochgdir == "Down")
e.Row.Background = Brushes.Beige as Brush;
e.Row.Background = Brushes.GreenYellow as Brush;
Note the difference in the new code is that I create a RowDataContext variable rather than a DataRowView variable. The resulting code is a bit simpler and IT WORKS! The DataGrid is bound to an observablecollection of "OptionChain" objects and ochgdir is a property of each of those objects.
I'm wondering if the problem with the original version might have something to do with one-way vs. two-way binding which, in effect, doesn't allow the assignment in my original LoadingRow event handler? If that's not the case, oh well, it's still a mystery!