TreeView expanded Item

2 posts, 0 answers
  1. Sravan Kumar Uddarraju
    Sravan Kumar  Uddarraju avatar
    16 posts
    Member since:
    May 2008

    Posted 29 Sep 2010 Link to this post


    I have RadTreeview and its Itemtemplates has Checkboxs on it. When I expand the TreeView item (without selecting), events (of the checkbox) with in the Itemtemplates are getting fired and failing code due to there are no selected item in Treeview.


    My question is there any property for getting expanded item (index) when I expand the treeview node?


  2. Petar Mladenov
    Petar Mladenov avatar
    2991 posts

    Posted 04 Oct 2010 Link to this post

    Hello Sravan Kumar Uddarraju,

    The way to get the index of the TreeViewItem that you have just expanded is to handle one of the events:  RadTreeView.Expanded (for all treeViewItems) or RadTreeViewItem.Expanded (for a particular one). It should be something like this:

    private void radTreeView_Expanded(object sender ,Telerik.Windows.RadRoutedEventArgs e)
            RadTreeViewItem currentExpanded = e.OriginalSource as RadTreeViewItem;
            int index = currentExpanded.Index;
            //Do your index logic here...

    You may also find it useful to know that you can detect the Initially checked TreeViewItem when the tree is in tristate mode.  In this case you can handle the Checked  event of the TreeViewitem  and use the IsUserInitiated boolean property.

    Hope this helps  you . Please let us know if we can further assist you.

    Sincerely yours,
    Petar Mladenov
    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
Back to Top