Sergey
Sergey

Reputation: 21

Selected item in RadTreeView

How can i retreive "Header" of selected item in RadTreeView(SilverLight) control?

Upvotes: 2

Views: 2517

Answers (1)

iCollect.it Ltd
iCollect.it Ltd

Reputation: 93561

Assuming I understand correctly that you only want to get at header content (in this example simple text) and that you are using RadTreeViewItem as your tree nodes you could do something like this in your selection event response:

private void radTreeView1_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
    foreach (RadTreeViewItem item in e.AddedItems)
    {
       string header = item.Header.ToString();
       // Do soemthing with the header value here
    }
}

This example allows for multiple selection mode, but works as well for a single selection.

Upvotes: 1

Related Questions