TreeListView : Expanded/Collpased Event

5 posts, 1 answers
  1. neha
    neha avatar
    5 posts
    Member since:
    May 2010

    Posted 14 Jun 2011 Link to this post

    Hello,

    I need help regarding the TreeListView's Expand/Collpase event. I am unable to capture these events  when i click on the expander.

    The code is as follows:-

    WPF XAML File:-

      <telerik:RadTreeListView x:Name="radTreeListView" telerik:StyleManager.Theme="Windows7"
                                     AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed" 
                                     ScrollViewer.VerticalScrollBarVisibility="Hidden"
                                     TreeViewItem.Collapsed="radTreeListView_Collapsed"
                                     TreeViewItem.Expanded="radTreeListView_Expanded" >
                <telerik:RadTreeListView.ChildTableDefinitions>
                    <telerik:TreeListViewTableDefinition ItemsSource="{Binding TopLevelObjects}"/>
                </telerik:RadTreeListView.ChildTableDefinitions>
                <telerik:RadTreeListView.Columns>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding LHS}"
                                       Header="Name"/>
               
                </telerik:RadTreeListView.Columns>
            </telerik:RadTreeListView>

    The two function radTreeListView_Collapsed(..) & radTreeListView_Expanded(..) are not getting called.


    Thanks,
    Neha
  2. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 14 Jun 2011 Link to this post

    Hi,

     There are no such events in RadTreeListView! To achieve your goal you should use RowIsExpandedChanged. 

    Greetings,
    Vlad
    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
  3. Manishkumar
    Manishkumar avatar
    240 posts
    Member since:
    Feb 2009

    Posted 15 Oct 2011 Link to this post

    Hi,
    But how to know whether the row is expanded or collapsed ?
  4. Michael
    Michael avatar
    33 posts
    Member since:
    Nov 2014

    Posted 13 Aug 2019 Link to this post

    I would like to know if row is expanded or collapsed as well.  8 years later.
  5. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2298 posts

    Posted 16 Aug 2019 Link to this post

    Hello Michael,

    To achieve your requirement, you can use the RowIsExpandedChanged event of RadTreeListView. Then get the row from the event arguments and check its IsExpanded property. Here is an example in code:

    private void RadTreeListView_RowIsExpandedChanged(object sender, Telerik.Windows.Controls.GridView.RowEventArgs e)
    {
    	var row = e.Row as Telerik.Windows.Controls.TreeListView.TreeListViewRow;
    	var isExpanded = row.IsExpanded;
    }

    Regards, Martin Ivanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top