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

Issue with accessing TadTreeViewItem

1 Answer 25 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ganesh Jagdale
Top achievements
Rank 1
Ganesh Jagdale asked on 19 Mar 2010, 08:40 AM
Hi Telerik,
     Thanks for providing such custamisable control. It is very effective and attractive.
I created TreeView which contain "HyperlinkButton" on each RadTreeViewItem for using silverlight NavigationService like this


RadOutlookBarItem
 radOutlookBarItem =

new RadOutlookBarItem();

 

 

HyperlinkButton hyperlinkButton = new HyperlinkButton();

 

hyperlinkButton.Content = "This is Telerik";
radOutlookBarItem.Header =  hyperlinkButton ;

On clicking that radOutlookBarItem  Selected event  is not fired. This may happened because of hyperlinkButton.
But HyperlinkButton Click is fired . Then How I can access RadTreeViewItem on which that HyperlinkButton is clicked.
 Even I checked in that event,  I got null value in SelectedItem of RadTreeView.

Is there any other way to get RadTreeViewItem after clicking it's HyperlinkButton?

Pls Help me out....

Thanks and Regards
Ganesh
 

 

 

 


 

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 24 Mar 2010, 06:38 PM
Hello Ganesh Jagdale,

You can use the ParentOfType() method in the Click() event handler to find the RadTreeViewItem parent of the clicked HyperlinkButton like this:

private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            HyperlinkButton btn = sender as HyperlinkButton;
            RadTreeViewItem item = btn.ParentOfType<RadTreeViewItem>();
        }

Please take a look at this to learn more about the generic ParentOfType() method.

Please let me know if you need more info.

Greetings,
Tina Stancheva
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
TreeView
Asked by
Ganesh Jagdale
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or