RadTreeViewItem - event MouseLeftButtonDown or Up never fires

6 posts, 0 answers
  1. James
    James avatar
    47 posts
    Member since:
    Jun 2009

    Posted 20 Jul 2009 Link to this post

    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
  2. Bobi
    Admin
    Bobi avatar
    513 posts

    Posted 21 Jul 2009 Link to this post

    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.
  3. DevCraft banner
  4. James
    James avatar
    47 posts
    Member since:
    Jun 2009

    Posted 21 Jul 2009 Link to this post

    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


  5. Bobi
    Admin
    Bobi avatar
    513 posts

    Posted 21 Jul 2009 Link to this post

    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.
  6. Pierre-Paul
    Pierre-Paul avatar
    2 posts
    Member since:
    Jun 2011

    Posted 29 Jun 2011 Link to this post

    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

     

  7. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 05 Jul 2011 Link to this post

    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!
Back to Top
DevCraft banner