Highlight whole TreeViewItem line in WPF

前端 未结 9 743
暗喜
暗喜 2020-11-30 17:48

If I set TreeViewItem Background it highlights the header only. How can I highlight the whole line?

I have found a post almost solving a problem http://social.msdn.

9条回答
  •  囚心锁ツ
    2020-11-30 18:50

    This is by far the easiest solution. Just create a rectangle, call it Hb, and set its margine to -100px and not visible. Only set it to Visible when you've it selected or mouse over. It's a hack, but you're good for up to 5 levels of nested TreeViewItems (100 > 19*5)

         
      
       
        
        
       
       
        
        
       
                            
       
                            
        
       
       
      
    

提交回复
热议问题