Highlight whole TreeViewItem line in WPF

前端 未结 9 705
暗喜
暗喜 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

    If you mean something like this screenshot


    (source: bendewey.com)

    Then this should help you. Its based on http://msdn.microsoft.com/en-us/library/ms788727.aspx you can make some changes to the TreeViewItem's Grid layout. Basically you remove the third column. Then in the TreeView you set the HorizontalContentAlignment="Stretch". I'm attaching the entire resource below, but here is the important part.

    
    
      
        
          
          
        
        
          
          
        
        
    

    Control

    
        
        
            
            
        
        
    
    

    Resources

    
    
    
    
    
    
    
    
    

提交回复
热议问题