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

[Solved] Clear selection by clicking in background

3 Answers 107 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.
Terry Foster
Top achievements
Rank 1
Terry Foster asked on 08 Jul 2011, 05:18 PM
Hi,

Can you tell me the simplest approach to clearing the grid's selected item(s) when the user clicks in the grid's background (i.e., below all rows)?

Thanks,
Terry

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 14 Jul 2011, 09:05 AM
Hi Terry Foster,

You could try subscribing to the MouseLeftButtonDown or MouseLeftButtonUp events and clear the selection in the event handler.

public MainPage()
{
    InitializeComponent();
  
    this.clubsGrid.MouseLeftButtonUp += new MouseButtonEventHandler(clubsGrid_MouseLeftButtonUp);
}
  
void clubsGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
    this.clubsGrid.SelectedItems.Clear();
}


All the best,
Milan
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!

0
Amit Patel
Top achievements
Rank 1
answered on 14 Jul 2011, 02:58 PM
The solution you provided does not work. I have grid's selectionMode set to extended and when i make selection it clears it up right away, so i never see anything selected on the grid. Is there alternative solution?

Thanks,
Amit
0
Milan
Telerik team
answered on 15 Jul 2011, 08:08 AM

Hi Amit Patel,

Changing the event to MouseLeftButtonDown should do the work. 


Greetings,
Milan
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
Terry Foster
Top achievements
Rank 1
Answers by
Milan
Telerik team
Amit Patel
Top achievements
Rank 1
Share this question
or