How to Hold the Row Selection After the Cell is Deactivated

15 Jun 20211 minute to read

Essential Grid enables you to hold the selection after the cell is deactivated. To hold the selection, cancel SelectionChanging event, when e.Reason is MouseDown or Clear.

The following code holds the selection even after the cell is deactivated:

void Model_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
    if (e.Reason == GridSelectionReason.MouseDown || e.Reason == GridSelectionReason.Clear)
        e.Cancel = true;
}
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