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

expand parent level row to show second level row

5 Answers 118 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 25 Aug 2010, 11:13 PM
Thanks for the new TreeListView control. By default the TreeListView loads my collection of data only showing the parent level.  The children levels are collapsed on the grid.  I was wondering if its possible to expand to show the second level rows of my hierarchy data by default.  I don't see anywhere to do this in the API.  Please help.

Thanks

5 Answers, 1 is accepted

Sort by
0
Christopher
Top achievements
Rank 1
answered on 25 Aug 2010, 11:44 PM
Never mind. I did the following and I got the second hierarchy level to expand--

RadTreeListView1.ExpandHierarchyItem(

 

this.RadTreeListView1.Items[0]);

 



Is there a way to do this declaratively in xaml?
0
Milan
Telerik team
answered on 26 Aug 2010, 03:54 PM
Hello Christopher,

Currently this is the preferred way of expanding items. We are considering to properties that will allow you to easily expand all items.


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
Corey
Top achievements
Rank 1
answered on 02 Nov 2010, 10:18 PM
Any progress on this? Having to iterate the ItemsCollection, etc to save/restore the state of a tree view isn't ideally how this should be done in WPF.

Thanks,

Corey
0
Milan
Telerik team
answered on 08 Nov 2010, 03:43 PM
Hi Corey,

I am afraid that there is not improvement on the matter. You might want to create a feature request using our Public Issue Tracking System so that other users can vote for this feature and boost its priority by doing so.


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
Sharada
Top achievements
Rank 1
answered on 03 Jan 2011, 01:33 PM
 Please try out this. This will expand the upto level 1.

Add below Event 
 
RadTreeListView1.ItemContainerGenerator.StatusChanged += new EventHandler(ItemContainerGenerator_StatusChanged);

 

 

void

 

 

ItemContainerGenerator_StatusChanged(object sender, EventArgs e) {
if (RadTreeListView1.ItemContainerGenerator.Status == System.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated)
{

 

 

 

 

if (RadTreeListView1.Items != null && RadTreeListView1.Items.Count > 0)

 

 

{

 

for (int i = 0; i < RadTreeListView1.Items.Count; i++)

 

 

{

 

 

TreeListViewRow objRow = (TreeListViewRow)RadTreeListView1.ItemContainerGenerator.ContainerFromIndex(i);

 if (objRow != null && !objRow.IsExpanded)

 

 

{

 

 

 

if (objRow.Level == 0 || objRow.Level == 1) 
 objRow.IsExpanded =
true; }

 

 

}

}

}
}

 

 

 

Tags
TreeListView
Asked by
Christopher
Top achievements
Rank 1
Answers by
Christopher
Top achievements
Rank 1
Milan
Telerik team
Corey
Top achievements
Rank 1
Sharada
Top achievements
Rank 1
Share this question
or