开发者

WPF - How do I set certain rows in a DataGrid to a different color?

I have a DataGrid. After I set the DataContext property to the source of my data, I would like to programatically (C#) set the color of certain rows to say red if data开发者_Python百科 in the row meets a certain condition. How can I do this?


If you're using the MVVM pattern and you have a ViewModel object representing each row in the DataGrid then I'd expose either a property of type Color on the ViewModel, or a property in conjunction with a ValueConverter which changes the value of the property (of whatever type) to a Color.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜