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

Set expanded state on load...

3 Answers 38 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 01 May 2012, 11:57 PM

I'm trying to set the expanded state on load. I'm using the following RowLoaded handler.

 

private void PspTreeListView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
{
    PspTreeViewObject pspTreeViewObject = e.DataElement as PspTreeViewObject;
    TreeListViewRow treeListViewRow = e.Row as TreeListViewRow;
 
    if (treeListViewRow != null && pspTreeViewObject != null)
    {
        treeListViewRow.IsExpanded = pspTreeViewObject.IsExpanded;
    }
}>

 

This works to set the expanded state properly, but then none of the items in the treeview can be expanded or contracted. I tried setting IsExpandable to true for the items, but that didn't work either. It seems that once the initial state is set, it cannot be changed.

Any ideas on how I can fix this?

 

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 02 May 2012, 08:47 AM
Hi,

 If you want to expand all the hierarchy items initially, you should set the AutoExpandItems property of the TreeListView to True.

Is this what do you need?

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Eric
Top achievements
Rank 1
answered on 02 May 2012, 05:31 PM
Sorry I wasn't clearer.

I need to have a treeview where the initial state has some nodes expanded and some nodes collapsed, and the user can then expand or collapse nodes at will.
0
Dimitrina
Telerik team
answered on 03 May 2012, 11:27 AM
Hi,

 For such a scenario, I would recommend you to check this forum post.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TreeListView
Asked by
Eric
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Eric
Top achievements
Rank 1
Share this question
or