Articles in this section

How to Disable Focus on Grid Cells in WinForms GridGroupingControl?

Disable the focus on grid cells


To disable the focus on the cells for making the read-only grid cells, you can cancel the TableControlCurrentCellActivating event in WinForms GridGroupingControlIn the following code example, the focus is disabled only on the record cells as you can apply filtering even when the Grid is ReadOnly.

 

//disables the focus on the RecordFieldCell
void gridGroupingControl1_TableControlCurrentCellActivating(object sender, GridTableControlCurrentCellActivatingEventArgs e)
{
   GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
   if(style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
   {
      e.Inner.Cancel = true;
   }
}
'disables the focus on the RecordFieldCell
Private Sub gridGroupingControl1_TableControlCurrentCellActivating(ByVal sender As Object, ByVal e As GridTableControlCurrentCellActivatingEventArgs)
   Dim style As GridTableCellStyleInfo = Me.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex)
   If style.TableCellIdentity.TableCellType = GridTableCellType.RecordFieldCell OrElse style.TableCellIdentity.TableCellType = GridTableCellType.AlternateRecordFieldCell Then
      e.Inner.Cancel = True
   End If
End Sub

After applying the properties, the Grid is displayed as follows.

Show read only grid

     Figure 1: Read only Grid

Conclusion

I hope you enjoyed learning about how to disable the focus on grid cells event in WinForms GridGroupingControl.

You can refer to our WinForms GridGroupingControl’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridGroupingControl documentation to understand how to present and manipulate data.

 

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms GridGroupingControl and other WinForms components.

 

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied