开发者

Color cells in WPF DataGrid dynamically

I populate t开发者_如何学Gohe contents of a WPF DataGrid with dynamic data that is the result of a search. Now I would like to highlight those cells of the DataGrid, that contain data which was matched during the search. Some hints about how this could be achieved are given here. Is there more elegant solution to this problem?


Binding to the data is the best way. However if the data doesn't have the appropriate values then a converter needs to be employed (as in the examples).

if you want something more elegant, I'd add a conversion within the data and bind to that property instead

say like :

  public int RealProperty { .... }

  public SystemColors.AppWorkspaceColor Colour { return manglefromInt(RealProperty); }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜