How do I bind the background of a data grid row to specific color?

前端 未结 1 1102
梦如初夏
梦如初夏 2020-12-18 19:45

I have a observable collection that binds to a data grid. I also have in the view model a color property and I want to bind the background of each row in the data grid to th

1条回答
  •  南笙
    南笙 (楼主)
    2020-12-18 20:29

    You can bind the Background in the RowStyle for DataGrid

    
        
            
        
        
    
    

    This will work if MyBackground is a Brush. You mention in your question that you have a Color, if this is the case you can use this instead

    
        
            
        
    
    

    0 讨论(0)
提交回复
热议问题