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

后端 未结 8 1590

The default background color of a selected row in DataGrid is so dark that I can\'t read it. Is there anyway of overriding it?

Tried this



        
8条回答
  •  囚心锁ツ
    2020-11-28 20:19

    As an extention to @Seb Kade's answer, you can fully control the colours of the selected and unselected rows using the following Style:

    
    

    You can of course enter whichever colours you prefer. This Style will also work for other collection items such as ListBoxItems (if you replace TargetType="{x:Type DataGridRow}" with TargetType="{x:Type ListBoxItem}" for instance).

提交回复
热议问题