I'd like to expand all TreeListView nodes when the data is loaded. I tried to use DataLoaded event for it but got a problem. After calling ExpandAllHierarchyItems() in DataLoaded event handler, this event fires again and app goes into infinite loop. How can I handle with it? Note: I need expanded tree after each data update, not only once.
5 Answers, 1 is accepted
0
Hello Max,
Greetings,
Milan
the Telerik team
You could try something like this:
public
MainPage()
{
InitializeComponent();
this
.RadTreeListView1.DataLoaded +=
new
EventHandler<EventArgs>(RadTreeListView1_DataLoaded);
}
bool
isExpanding =
false
;
void
RadTreeListView1_DataLoaded(
object
sender, EventArgs e)
{
if
(
this
.isExpanding)
{
return
;
}
this
.isExpanding =
true
;
this
.RadTreeListView1.ExpandAllHierarchyItems();
this
.isExpanding =
false
;
}
Hope this helps.
Greetings,
Milan
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
0

Max
Top achievements
Rank 1
answered on 16 Jun 2011, 08:44 AM
With this solution tree is always expanded and it's impossible to shrink any of it's nodes. Somehow DataLoaded event occurs not only in case of data loading but also when clicking a "triangle" to shrink the node.
0
Hello Max,
You could try adding the following line to the event handler:
All the best,
Milan
the Telerik team
You could try adding the following line to the event handler:
// usubscribe
this
.RadTreeListView1.DataLoaded -=
new
EventHandler<EventArgs>(RadTreeListView1_DataLoaded);
All the best,
Milan
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
0

Max
Top achievements
Rank 1
answered on 06 Jul 2011, 09:15 AM
Hello Milan
Stilll no acceptable solution for this issue. Unsubscribe from the event isn't a good way. As I said in the first post I need expanded tree not once, but every time the data is loaded.
Stilll no acceptable solution for this issue. Unsubscribe from the event isn't a good way. As I said in the first post I need expanded tree not once, but every time the data is loaded.
0

Max
Top achievements
Rank 1
answered on 15 Jul 2011, 01:33 PM
Is it possible to keep TreeListView always expanded and with actual data without constant management of it's internals?