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

Right-click in RadTreeListView doesn't select clicked Row

2 Answers 100 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Arinto
Top achievements
Rank 1
Arinto asked on 10 Mar 2011, 06:55 AM
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 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 11 Mar 2011, 01:02 PM
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!
0
Arinto
Top achievements
Rank 1
answered on 14 Mar 2011, 04:18 AM
Thanks Ivan, 

It works like a charm. 

Regards, 

Arinto
Tags
TreeListView
Asked by
Arinto
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Arinto
Top achievements
Rank 1
Share this question
or