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

RadGrid deselect rows when clicked outside the gridview

3 Answers 225 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Resource Management
Top achievements
Rank 1
Resource Management asked on 14 Mar 2011, 03:37 AM
Hi,

I want to implement the following functionality:

If I have any rows selected and user clicks anywhere outside rows region, then rows become deselected. I tried to use LostFocus event it works partialy. It does deselect rows however to select a row I now need to click twice. Any suggestions how to implement this?

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 14 Mar 2011, 08:49 AM
Hi Joanne Ryder,

You may subscribe to the MouseLeftButtonDown event for example and handle it like follows:

private void clubsGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var element = e.OriginalSource as FrameworkElement;
            var parent = element.ParentOfType<GridViewRow>();
            if(parent == null)
            {
                this.clubsGrid.UnselectAll();
            }          
        }

 

All the best,
Maya
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
Resource Management
Top achievements
Rank 1
answered on 15 Mar 2011, 01:14 AM
I need it to work with MVVM.
0
Vlad
Telerik team
answered on 15 Mar 2011, 07:50 AM
Hi,

 In this case you will need to create custom attached behavior - for example similar to this demo

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