Right-click in RadTreeListView doesn't select clicked Row

3 posts, 0 answers
  1. Arinto
    Arinto avatar
    25 posts
    Member since:
    Nov 2010

    Posted 10 Mar 2011 Link to this post

    Hi, 

    I just realized that in RadTreeListView, when I do right-click using my  mouse, the clicked row doesn't selected like normal .NET GridView.
    So how to make the clicked row selected? 

    I would like to use the clicked row as the data for context menu event handler.

    Regards, 

    Arinto
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 11 Mar 2011 Link to this post

    Hello Arinto,

    You may try this approach:

    public MainWindow()
          {
              InitializeComponent();
              testTreeListView.RowLoaded += new EventHandler<RowLoadedEventArgs>(testTreeListView_RowLoaded);
          }
          void testTreeListView_RowLoaded(RowLoadedEventArgs e)
          {
              if (e.Row.Item != null)
              {
                  e.Row.MouseRightButtonDown += new MouseButtonEventHandler(Row_MouseRightButtonDown);
              }
          }
          void Row_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
          {
              (sender as GridViewRow).IsSelected = true;
          }

    Furthermore, you may unsubscribe from the MouseRightButtonDown during the RowUnloaded event thus reducing the memory consumption.
    Please, let us know, if this solution fits into your requirements.


    Regards,
    Ivan Ivanov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. UI for WPF is Visual Studio 2017 Ready
  4. Arinto
    Arinto avatar
    25 posts
    Member since:
    Nov 2010

    Posted 13 Mar 2011 Link to this post

    Thanks Ivan, 

    It works like a charm. 

    Regards, 

    Arinto
Back to Top