Converterpublic class BrushConverter : IValueConverter{ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string input = value as string; switch (input) { case "ERROR": return Brushes.Red; case "OK": return Brushes.Green; default: return DependencyProperty.UnsetValue; } }public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture){ throw new NotSupportedException();} 我只是想绑定数据集列来触发。如果触发器获得ERROR字符串,则backgrounfrow颜色变为红色。和副vrsa。I just Want to bind dataset column to trigger. If trigger get ERROR string then backgrounfrow color change to red. and vice vrsa.推荐答案 这将对你有所帮助: http://stackoverflow.com/questions/5549617/change-datagrid-cell-colour-based-on-values [ ^ ] This will help you:http://stackoverflow.com/questions/5549617/change-datagrid-cell-colour-based-on-values[^] 这篇关于如何使用从wpf中的数据库获取的值更改datagried行背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-03 15:18