WPF TreeView with right alignment values

前端 未结 2 643
旧巷少年郎
旧巷少年郎 2021-01-14 20:26

I have a problem with my wpf treeview. It\'s code goes like this:



        
2条回答
  •  忘掉有多难
    2021-01-14 20:54

    If I understand your question correctly you want to Stretch the TreeViewItems and align Value to the right. To get the TreeViewItems to Stretch Horizontaly you'll need to edit the Template for TreeViewItem. The problem is explained here: http://leecampbell.blogspot.com/2009/01/horizontal-stretch-on-treeviewitems.html

    Here is an edited version of the TreeViewItem which does this. Note that you'll have to add a reference to PresentationFramework.Aero for this to work

    Sample
    enter image description here

    
        
            
                
                    
                    
                
            
        
    
    

    StretchTreeViewItemStyle

    
    
    
    
    

提交回复
热议问题