WPF TreeView databinding to hide/show expand/collapse icon
        Posted  
        
            by Julian Lettner
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Julian Lettner
        
        
        
        Published on 2010-04-19T15:32:14Z
        Indexed on 
            2010/04/21
            13:23 UTC
        
        
        Read the original article
        Hit count: 2176
        
I implemented a WPF load-on-demand treeview like described in this (very good) article.
In the mentioned solution a dummy element is used to preserve the expand + icon / treeview item behavior. The dummy item is replaced with real data, when the user clicks on the expander.
I want to refine the model by adding a property public bool HasChildren { get { ... } } to my backing TreeNodeViewModel.
Question:
How can I bind this property to hide/show the expand icon (in XAML)? I am not able to find a suitable trigger/setter combination.
(INotifyPropertyChanged is properly implemented.)
Thanks for your time.
Update 1:
I want to use my property public bool HasChildren instead of using the dummy element.
Determining whether or not an item has children is somewhat costly, but still much cheaper than fetching the children.
© Stack Overflow or respective owner