TreeListView Expand All/ Collapse All Hierarchy Items

8 posts, 0 answers
  1. Kumar
    Kumar avatar
    17 posts
    Member since:
    May 2011

    Posted 31 Aug 2011 Link to this post

    Hello Telerik Team,

    I want to expand / collapse all hierarchy levels of a RadTreeListView in C# code. 
    I have multi level hierarchy items (generally 3-4 levels deep)

    When I use
     
    radTreeListView.ExpandAllHierarchyItems();
     
    radTreeListView.CollapseAllHierarchyItems();

    This only expands or collapses the first level hierarchy, the inner levels are left unchanged.

    Any ideas on how to expand or collapse recursively all the way to the last level?

    Thanks in Advance.
    - Kumar
  2. Vera
    Admin
    Vera avatar
    263 posts

    Posted 01 Sep 2011 Link to this post

    Hello Kumar,

    Actually, I am not able to reproduce the issue you specified. Please take a look at the sample project attached and let me know if I am missing something according to your requirements.

    All the best,
    Vera
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Kumar
    Kumar avatar
    17 posts
    Member since:
    May 2011

    Posted 01 Sep 2011 Link to this post

    Hey Vera,

    Thanks for your reply and sample code. But this is not what I was looking for.

    Let me explain using your attached example, please follow these steps:

    1. Run your code, this will open up the TreListView with everything collapsed
    2. Expand 'Drinks' node
    3. Expand 'Tea' node under Drinks
    4. Expand 'Mint' node under Tea
    5. Click Collapse button (Here I expect all the nodes under Drinks node including Tea and Mint to collapse)
    6. On clicking Collapse we see that the Drinks node has collapsed
    7. Expand Drinks node again and see that Tea and Mint nodes are still expanded. (this is not what I want in step 5)

    I hope I am clear that when I hit the collapse button, all nodes and sub nodes till the last level should be collapsed, i.e. in this case on clicking Collapse button Drink, Tea, Mint nodes should all collapse.

    Let me know if this can be done.

    Regards,
    Kumar

  5. Vera
    Admin
    Vera avatar
    263 posts

    Posted 03 Sep 2011 Link to this post

    Hi Kumar,

    Thank you for the addtional information.
    May I ask you to confirm that the version of the controls you have installed is the latest official Q2 2011?
    If you use an older version I would suggest you to download Q2 2011 and everything should work properly.
    I hope this helps. Let me know how it goes.

    All the best,
    Vera
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. Kumar
    Kumar avatar
    17 posts
    Member since:
    May 2011

    Posted 01 Mar 2012 Link to this post

    Is there any property that tells me the current state of RadTreeViewList's expandAll and CollapseAll ? 
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 02 Mar 2012 Link to this post

    Hi,

     With our latest official version (Q1 2012) you can use AutoExpandItems property of the treelist instead. 

    Kind regards,
    Vlad
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  8. Kumar
    Kumar avatar
    17 posts
    Member since:
    May 2011

    Posted 02 Mar 2012 Link to this post

    ??

    I am using the latest version of control. 

    Let me rephrase my question. I have 2 buttons "Expand All" and "Collapse All". 

    When you click on "Expand All" - i call this
    radTreeListView.ExpandAllHierarchyItems();

    When you click on "Collapse All" - i call this
    radTreeListView.CollapseAllHierarchyItems();

    I want disable each of the button based on if the "TreeListView" items are expanded or collapsed.  

  9. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 05 Mar 2012 Link to this post

    Hello,

     As I said in my previous reply you should use AutoExpandItems  to achieve your goal however it seems that you've missed to try it. When you set this property to true the treelist will expand all items and when you set it to false all items will be collapsed. You can bind IsEnabled property of your buttons using IValueConverter to this boolean property. 

    Regards,
    Vlad
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
UI for WPF is Visual Studio 2017 Ready