Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
785
De-Select the Selected Row for a Single Selection gridView
posted

Hi - I'm sure this is pretty easy, but wanted to ask to make sure I do this right. Currently, I have a gridView that allows for single selection. I want to add the capability if the SelectedRow is Selected again it will De-Select the row. Very similar to how the gridView with Multiple Selection works but with only allowing Single Selection. What is the best way to approach this.

Thanks.

  • 40030
    Verified Answer
    Offline posted

    Hi, 

    Actually, thats not possible with Single selection. 

    BUT, its really easy to get that same behavior with multiple selection, by using WillSelectRow off of the delegate. Just simply add the following code to your delegate:

        public override IGRowPath WillSelectRow (IGGridView gridView, IGRowPath path)
            {
                gridView.DeselectAll ();

                return path;
            }


    And make sure you have multiple selection turned on: 

    gridView.AllowsMultipleSelection = true;

    Thats it!

    Only one row will ever be selected at any given time. And the row selection event will still fire off correctly. 

    I hope this helps, 

    -SteveZ