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

RadTreeViewItem - event MouseLeftButtonDown or Up never fires

5 Answers 132 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 21 Jul 2009, 03:46 AM
I bound the RadTreeViewItem.MouseLeftButtonDown to an event handler in code, but in debug I noticed the event never fires. I didn't use the RadTreeViewItem.Selected event because when a the item is selected, when use click the item again the Selected event don't fire - this is not I want, so I have to handle the MouseLeftButtonDown or Up events but... the two events never fire. Help!

(system: Silverlight 2 with Telerik 2009.1.526.1020)

Thanks
James

5 Answers, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 21 Jul 2009, 08:55 AM
Hello James,

In order to accomplish the desired functionality you have to use MouseLeftButtonUp  event.

Please find attached a sample project that shows how to use MouseLeftButtonUp event with RadTreeView.

Kind regards,
Boryana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
James
Top achievements
Rank 1
answered on 21 Jul 2009, 09:16 AM
yes, the way in sample works for me. you use TreeView.OnMouseLeftButtonUp event and the SelectedItem to fulfill the same functionality that I wanted to use TreeViewItem.OnMouseLeftButtonUp event. So is that a bug about TreeViewItem.OnMouseLeftButtonUp event?

thanks


0
Bobi
Telerik team
answered on 21 Jul 2009, 10:35 AM
Hello James,

Please find attached a sample project that shows how to use  MouseLeftButtonUp event of RadTreeViewItem.

As you can see in the project  MouseLeftButtonUp  is working properly as expected.

I hope that this answers your question.

All the best,
Boryana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Pierre-Paul
Top achievements
Rank 1
answered on 30 Jun 2011, 04:54 AM

From this sample, I wrote the following:

 

 

 

Private Sub MenuTreeView_MouseLeftButtonUp(sender As System.Object, e As System.Windows.Input.MouseButtonEventArgs)

 

 

 

    Dim treeview As Telerik.Windows.Controls.RadTreeView = TryCast(sender,Telerik.Windows.Controls.RadTreeView)

 

 

 


    Dim
HeaderOfClickedItem As String

 

 

 

 

 

 

    HeaderOfClickedItem = treeview.SelectedItem.ToString

 

 

    MessageBox.Show(" we clicked on ... " + HeaderOfClickedItem)

 

 

 

End Sub

This enables me to acces the Header of the ClickedItem.  However, I need to access for instance the TAG attribute in doing something like

 

    TAGOfClickedItem = treeview.SelectedItem.TAG
howewer only the header is available with the .tostring  converter
 
Need help to find a way to do it

 

0
Petar Mladenov
Telerik team
answered on 05 Jul 2011, 12:57 PM
Hello Pierre-Paul,

The SelectedItem property returns object. Since the RadTreeView is not bound , you need to cast it to a RadTreeViewItem like so:
Dim item As Telerik.Windows.Controls.RadTreeViewItem = TryCast(Me.treeView.SelectedItem, Telerik.Windows.Controls.RadTreeViewItem)
Dim tag As Object = item.Tag


Regards,
Petar Mladenov
the Telerik team
Register for the Q2 2011 What’s New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
Tags
TreeView
Asked by
James
Top achievements
Rank 1
Answers by
Bobi
Telerik team
James
Top achievements
Rank 1
Pierre-Paul
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or