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

[Solved] How to select cell on right click?

4 Answers 148 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joshua
Top achievements
Rank 1
Joshua asked on 05 Jul 2011, 05:03 AM
How to make it such that when user right clicks a cell it gets selected? Thanks.

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 05 Jul 2011, 06:33 AM
Hello,

 Have you checked this demo?

Regards,
Vlad
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
0
Joshua
Top achievements
Rank 1
answered on 05 Jul 2011, 07:57 AM
It seems to select on left click but not right click.
0
Joshua
Top achievements
Rank 1
answered on 18 Jul 2011, 02:32 AM
Any help with this? I just want to select a cell when the user right clicks (not just left click)
0
Maya
Telerik team
answered on 18 Jul 2011, 08:57 AM
Hello Joshua,

You may try to subscribe to the MouseRightButtonDown and do something as follows:

this.clubsGrid.MouseRightButtonDown += new MouseButtonEventHandler(clubsGrid_MouseRightButtonDown);        
 
void clubsGrid_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
            FrameworkElement element = e.OriginalSource as FrameworkElement;
            if(element !=null)
            {
                GridViewCell cell = element.ParentOfType<GridViewCell>();
                if(cell !=null)
                {
                    cell.IsSelected = true;
                }
            }
}


Let me know whether the suggested approach corresponds to your requirements.
 

All the best,
Maya
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
GridView
Asked by
Joshua
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Joshua
Top achievements
Rank 1
Maya
Telerik team
Share this question
or