This is a migrated thread and some comments may be shown as answers.

How I do have the expanded element?

3 Answers 106 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
David Cardona
Top achievements
Rank 1
David Cardona asked on 15 Apr 2010, 04:13 PM
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.


3 Answers, 1 is accepted

Sort by
0
Accepted
Miroslav
Telerik team
answered on 16 Apr 2010, 03:45 PM
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.
0
John Mitchell
Top achievements
Rank 1
answered on 18 Jun 2010, 01:09 AM
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!
0
Stefan Dobrev
Telerik team
answered on 22 Jun 2010, 01:50 PM
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
Tags
TreeListView
Asked by
David Cardona
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
John Mitchell
Top achievements
Rank 1
Stefan Dobrev
Telerik team
Share this question
or