wpf: DataGrid disable selected row styles - or row selecting

后端 未结 6 1715
野性不改
野性不改 2020-12-03 09:27

I am seeing a lot of examples on how to style Selected rows in DataGrid such as this one:

How can I set the color of a selected row in DataGrid

Can i just di

6条回答
  •  清歌不尽
    2020-12-03 10:23

    For those like me who have some cells with different styles and don't want to override all styles nor add triggers to each style, this is a good bet:

    
        
        
        
        
    
    

    HighlightBrushKey is the highlighted border with active selection and HighlightTextBrushKey is the text color with active selection

    In my case, I want inactive selection to look unselected:

    InactiveSelectionHighlightBrushKey is the border when selection is inactive and InactiveSelectionHighlightTextBrushKey is the text when selection is inactive

    FYI: SystemColors is a static class, part of System.Windows.Media namespace. You can inspect it and shamelessly override any color you don't like!

提交回复
热议问题