【发布时间】:2010-12-03 08:12:29
【问题描述】:
如何更改 silverlight 数据网格行的颜色?!
我已经尝试过了,但它似乎并没有按照我想要的方式工作...随机行的颜色不正确:
void dataGrid1_LoadingRow(object sender, DataGridRowEventArgs e)
{
var c = e.Row.DataContext as Job;
if (c != null && c.Status.Contains("complete"))
e.Row.Background = new SolidColorBrush(Colors.Green);
else
e.Row.Background = new SolidColorBrush(Colors.Red);
}
【问题讨论】:
-
我认为使用此代码不可能获得随机颜色的行 - 但如果您不总是设置背景颜色是可能的 - 请参阅下面的答案
标签: c# silverlight datagrid row