TreelistView Expand All items when load

4 posts, 0 answers
  1. Lior
    Lior avatar
    28 posts
    Member since:
    Aug 2012

    Posted 15 Jan 2013 Link to this post

    Hi,
    Currently we need to let all item expand when page loaded. I've looked into DataLoaded ,RowLoadedEvent in Treelist view. But Only find the two events triggered when click the togglebutton, This is not we need, Another workaround is using rowstyle, 
    http://www.telerik.com/community/forums/silverlight/treelist/when-to-call-expandall.aspx
    http://www.telerik.com/community/forums/silverlight/treelist/expand-all-root-items.aspx
    http://demos.telerik.com/silverlight/#TreeListView/FirstLook
    one is basing on old version, another is using style,but if we using style workaround, the collapse funcation will be lost !  and this demo using autoexpanitem property, this is not avaiable in our version.

    Thank you in advance.

    our telerik version is   2012.1.215.1040
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Jan 2013 Link to this post

    Hi,

    When you need to expand all the nodes in the tree use ExpandAllHierarchyItems() methods of the RadTreeListView.

    C#:
    treeListView.ExpandAllHierarchyItems()

    Regards,
    Princy.

  3. DevCraft banner
  4. Lior
    Lior avatar
    28 posts
    Member since:
    Aug 2012

    Posted 15 Jan 2013 Link to this post

    Thank you for your reply, but there is an issue that when We call this method, we r using MVVM, and we support event, As I say, dataLoaded or rowloaded event only triggered when click toggle button, We need page loading then expandall. 

    We've put this method in dataload event and row loaded event, but raise a error "Object reference not set to an instance of an object." , any suggestions?
  5. Lior
    Lior avatar
    28 posts
    Member since:
    Aug 2012

    Posted 15 Jan 2013 Link to this post

    I've found a workaround for MVVM, and if telerik control version is  2012.3.1129.1050, then just use AutoExpandItems ="true" in xaml,
    otherwise need a behavior attach to the contorl. If the solution is not MVVM, then in Code-bind to do this. 

    Here is true workaround for a dynamic treelistveiw using  MVVM to do this, Here is the solution, thanks the guy provide this:
    http://www.telerik.com/community/forums/silverlight/treelist/expandall-collapseall-recursively.aspx#2449226
    just see  Jonathan post.



Back to Top