How do I change the background color of a cell using WPF Toolkit Datagrid

前端 未结 4 1714
粉色の甜心
粉色の甜心 2020-12-05 05:11

I\'m using the WPF toolkit datagrid, and I\'d like to set the background color of a cell, not the row, based on the content of the cell.

For the sake of simplicity,

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-05 05:31

    A slightly different approaching is, instead of targeting the TextBlock element, which often leaves a border around the control, to the DataGridCell itself instead. In my case I already had a style I wanted to inherit from, I just needed to change background colours depending on the value:

    
    
        
            
        
    
    

    Might be of some use to people my situation.

提交回复
热议问题