How I do have the expanded element?

4 posts, 1 answers
  1. David Cardona
    David Cardona avatar
    20 posts
    Member since:
    Mar 2010

    Posted 15 Apr 2010 Link to this post

    Hello.

    We need to obtain the properties of element expanded at the tree, how I do that?

    I detect the event with:

       
    private void treeView_PreviewSelected(object sender, Telerik.Windows.RadRoutedEventArgs e) 

    But I don`t know how obtaint the properties object selected. 

    Thank you so much for your help.


  2. Answer
    Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 16 Apr 2010 Link to this post

    Hi David Cardona,

    The PreviewSelected event will fire just before an element is selected but it will not fire if an element is expanded by pressing the expand button. All items that have been added to the selection can be found in the e.AddedItems collection.

    Another option will be to handled the Expanded event which is fired when an item has been expanded. There you can use the e.Source and e.OriginalSource properties.

    Hopefully this will help you,

    All the best,
    Miroslav
    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. DevCraft banner
  4. John Mitchell
    John Mitchell avatar
    3 posts
    Member since:
    Oct 2009

    Posted 17 Jun 2010 Link to this post

    I'm running Q2 Beta which has the new version of the RadTreeListView and I would like to have custom code fire when the user expands a row.  In the old version, there was an expanded event but in the new version the expanded event does not exist.  How would I trigger something to happen when the row is expanded?

    Basically I am trying to have the system load up some secondary data in the child nodes before they are displayed.  I've tried all kinds of wacky things but nothing quite works.  I had the prior version working with the Expanded event but now that it seems to be gone, I can't figure out how to load things.

    Thank you!
  5. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 22 Jun 2010 Link to this post

    Hello John,

    You can subscribe for the TreeListViewRow.IsExpandedChangedEvent event with AddHandler(...) extension method in Telerik.Windows namespace. Here is a sample code snippet that does this:
    ...
     
        this.treeList.AddHandler(TreeListViewRow.IsExpandedChangedEvent, new RoutedEventHandler(OnIsExpandedChanged), true);
    }
     
    private void OnIsExpandedChanged(object sender, RoutedEventArgs e)
    {
        // Do logic on expand/collapse here.
    }
     
    ...

    We are thinking of exposing an event on the control itself that can be used as well.

    All the best,
    Stefan Dobrev
    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