New to Telerik UI for WPF? Download free 30-day trial

Expand all rows

This article shows how to expand all rows of RadTreeListView.

There are two options:

Option 1: Set the AutoExpandItems property of RadTreeListView to True. This property sets a value indicating if the hierarchy items should be expanded initially or not. Its default value is False.

Option 2: You can follow these steps to accomplish the same task:

  1. Subscribe to the DataLoaded event of the RadTreeListView:

        treeListView.DataLoaded += new EventHandler<EventArgs>(treeListView_DataLoaded); 
    
        AddHandler treeListView.DataLoaded, AddressOf treeListView_DataLoaded 
    
  2. Define the DataLoaded handler as follows:

        void treeListView_DataLoaded(object sender, EventArgs e) 
        { 
            treeListView.DataLoaded -= treeListView_DataLoaded; 
            treeListView.ExpandAllHierarchyItems();    
        } 
    
        Private Sub treeListView_DataLoaded(sender As Object, e As EventArgs) 
        treeListView.DataLoaded -= treeListView_DataLoaded 
        treeListView.ExpandAllHierarchyItems() 
        End Sub 
    

Note that we unsubscribe for that event on the first line, so it is not called for each child table. Calling the ExpandAllHierarchyItems will expand all parent rows.

Binding to the IsExpanded property of TreeListViewRow is not fully supported. You can consider using IsExpandedBinding property instead.

In this article