How do I set a DataTemplate for a WPF TreeView to display all Elements of an List?

前端 未结 3 1244
清歌不尽
清歌不尽 2020-12-20 22:15

I\'d like to visualize the following data structure using TreeViews in WPF:

class MyDataContext
{
    ICollectionView Outers {get;set;}
    //...
}

class Ou         


        
3条回答
  •  -上瘾入骨i
    2020-12-20 23:07

    I used the page Mateusz mentioned (HierarchicalDataTemplate) and after reading the answer to this question: Bind Collection to StackPanel I found a solution that did what I wanted:

    Here the players (level 3) are on the same row as the team (level 2):

    
        
        
            
                
                
                
                    
                        
                            
                            
                                
                                    
                                        
                                        
                                    
                                
                                
                                    
                                        

    the result

提交回复
热议问题