This is a migrated thread and some comments may be shown as answers.

TreelistView Expand All items when load

3 Answers 110 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Lior
Top achievements
Rank 1
Lior asked on 15 Jan 2013, 09:25 AM
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

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Jan 2013, 12:34 PM
Hi,

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

C#:
treeListView.ExpandAllHierarchyItems()

Regards,
Princy.

0
Lior
Top achievements
Rank 1
answered on 16 Jan 2013, 01:48 AM
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?
0
Lior
Top achievements
Rank 1
answered on 16 Jan 2013, 02:27 AM
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.



Tags
TreeListView
Asked by
Lior
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Lior
Top achievements
Rank 1
Share this question
or