RojerChen.20110919 在 silverlight 中,Datagrid 每列的 background color 要如何依照條件變色? using System.Windows.Media; private void dataGrid1_LoadingRow(object sender, DataGridRowEventArgs e) { DataGridRow row = e.Row; var c = row.DataContext as class_name; if (c != null && c.name == "1") e.Row.Background = new System.Windows.Media.SolidColorBrush(Colors.Green); else e.Row.Background = new System.Windows.Media.SolidColorBrush(Colors.Red); } 這樣,每列的顏色,就可以依照想要的條件進行變色了。