)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to hold the row selection after the cell is deactivated in WinForms GridControl?

Platform: WinForms |
Control: GridControl |
Published Date: May 13, 2016 |
Last Revised Date: February 10, 2020
Tags: selection, row

Hold the row selection

In order to hold the row selection after the cell is deactivated, the SelectionChanging event can be used. The selection can be canceled by using Cancel property.

C#

// form()
// Trigger the required event.
gridControl1.Model.SelectionChanging += Model_SelectionChanging;
 
void Model_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
   if (e.Reason == GridSelectionReason.MouseDown || e.Reason == GridSelectionReason.Clear)
      e.Cancel = true;
}

 

VB

' form()
' Trigger the required event.
Private gridControl1.Model.SelectionChanging += AddressOf Model_SelectionChanging
 
Private Sub Model_SelectionChanging(ByVal sender As Object, ByVal e As GridSelectionChangingEventArgs)
   If e.Reason = GridSelectionReason.MouseDown OrElse e.Reason = GridSelectionReason.Clear Then
   e.Cancel = True
   End If
End Sub

 

Screenshot

Showing hold the row selection in grid

Sample links:

C# HoldingRowSelection_CS

VB HoldingRowSelection_VB

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon