How to change expander style

2 posts, 0 answers
  1. Evgeny Vdovin
    Evgeny Vdovin avatar
    29 posts
    Member since:
    May 2006

    Posted 02 Feb 2011 Link to this post


    How can I change expander style on TreeView
    I use load on demand to load my treeview items.
    Please see attach image:
    What I want to do is:
    1. Remove the expander ( tri-angle) from Commodity 2 and Commodity 4, but keep the expanders of others, as Commodity 2 and 4 are not expandable.

    Is there a way to do it (using binding) ? Please give me an example.

    Evgeny Vdovin

  2. Petar Mladenov
    Petar Mladenov avatar
    3162 posts

    Posted 07 Feb 2011 Link to this post

    Hello Evgeny Vdovin,

    Please examine the attached solution where you can find a basic approach following your requirement. Basically, you can set IsLoadOnDemandEnabled = true on the RadTreeView but you can set this property to false on specific RadTreeViewitems like so:
    <telerik:RadTreeView x:Name="radTreeView" 
               <telerik:RadTreeViewItem Header="Sport Categories" IsExpanded="True">
                   <telerik:RadTreeViewItem Header="Football" IsLoadOnDemandEnabled="False" />
                   <telerik:RadTreeViewItem Header="Tennis" />
                   <telerik:RadTreeViewItem Header="Formula 1" IsLoadOnDemandEnabled="False" />
                   <telerik:RadTreeViewItem Header="Cycling" />
    When the treeview is bound to object ( hierarchy of objects), your business item could expose a property ( for example called LoadOnDemand) and you can bind this property to the IsLoadOnDemandEnabled property of the RadTreeViewItem using container bindings. You can find both approaches in the attached samples. Feel free to ask if you need further assistance.

    All the best,
    Petar Mladenov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top