TreeView shows blue for selected item

前端 未结 1 1248
滥情空心
滥情空心 2020-12-13 09:43

I have a treeview structure. When I try to click on the nodes there is a blue color that shows the node selected. How can I remove that. I don\'t want a selection color to

1条回答
  •  猫巷女王i
    2020-12-13 10:15

    ItemContainerStyle method does not work for me say on Windows-8. There are 4 brushes that generally correspond to this and are used by the default Template for TreeViewItem

    keys:

    HighlightBrushKey - Background with focus.

    HighlightTextBrushKey - Foreground with focus.

    InactiveSelectionHighlightBrushKey - Background without focus.

    InactiveSelectionHighlightTextBrushKey - Foreground without focus.

    Just override them as you see fit, for your requirement something like this would do fine:

    
      
        
        
        
        
      
    
    

    Do pay attention to only overriding them within the scope you require. For example if you put all this into App.xaml you're going to see some weird side-effects as all control's using these Brushes would now end up using your overridden ones which may not be what you're after.

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