Set expanded state on load...

4 posts, 0 answers
  1. Eric
    Eric avatar
    6 posts
    Member since:
    Feb 2012

    Posted 01 May 2012 Link to this post

    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?

     

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 02 May 2012 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Eric
    Eric avatar
    6 posts
    Member since:
    Feb 2012

    Posted 02 May 2012 Link to this post

    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.
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 03 May 2012 Link to this post

    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 >>

Back to Top