How to combine IsLoadOnDemandEnabled="True" with Hierarchical Templates

3 posts, 0 answers
  1. Karanjit Siyan
    Karanjit Siyan avatar
    7 posts
    Member since:
    Apr 2010

    Posted 28 May 2010 Link to this post

    If I set IsLoadOnDemandEnabled="True" on the RadTreeView, it sets the Expander node for all items in the tree including the leaf node. This is as it should be according to the documentation. Howerver, I have a tree that is constructed using Hierarchical templates. I want to set the IsLoadOnDemandEnabled="True" for only some of the nodes in the hierarchy. I can get this to work by setting the IsLoadOnDemandEnabled=True for the entire tree. However this puts the expander on all nodes including the last one (the leaf nodes). I don't want the expander in the leaf nodes. How to disable this?

    You can use the sample in the documentation -- and set IsLoadOnDemandEnabled="True" at the tree level, then try to set IsLoadOnDemandEnabled="True" at an intermediate node, or turn it off at the leaf nodes. I have tried to obtain the individual RadTreeViewItem and set the IsLoadOnDemandEnabled to False for the leaf node, but I still see the expander icon.


























































    ExpanderStyle="{StaticResource ExpanderStyle1}"






    ItemTemplateSelector="{StaticResource myDataTemplateSelector}"






    ItemsSource="{Binding Source={StaticResource MyList}}"






    ="True" />  <!-- This is the property that needs to be set selectively -->















  2. Karanjit Siyan
    Karanjit Siyan avatar
    7 posts
    Member since:
    Apr 2010

    Posted 29 May 2010 Link to this post

    I fixed the issue that I just described by adding a handler for ItemsPrepared:



    private void xxxx_ItemPrepared(object sender, RadTreeViewItemPreparedEventArgs e)





        RadTreeViewItem item = (RadTreeViewItem)e.PreparedItem;




        if (item.Item is FileNode)



            item.IsLoadOnDemandEnabled =






  3. Bobi
    Bobi avatar
    513 posts

    Posted 02 Jun 2010 Link to this post

    Hello Karanjit Siyan,

    You can also take a look at the following online example that demonstrates the usage of LoadOnDemand with HierarchicalTemplate:

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top