Why can't I set the background color of a selected ListBoxItem in WPF?

后端 未结 4 978
攒了一身酷
攒了一身酷 2021-01-03 01:29

When a user clicks on an ListBoxItem, I want to it to be a bold larger font red background yellow

Everything works except the background. It seems that there is a st

4条回答
  •  囚心锁ツ
    2021-01-03 02:04

    It can be done a lot simpler. The Background color for the selected ListBox items are taken from the SystemColors. So, what you need to do is override the SystemColors in the Resources of your ListBox:

    
        
        
        
        
    
    

提交回复
热议问题