How to set grid model options in WinForms GridControl?
Grid model options
There are six WinForms GridControl model options that can be set to the grid cells, which are explained below in this article.
1. Activating Current Cell Behavior
In order to set the current cell activating behavior, the ActivateCurrentCellBehavior property can be used.
C#
//Activate current cell behavior
this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;VB
'Activate current cell behavior
Me.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll
2. Allow scroll for the Current cell view
In order to set the visibility of the current cell, the AllowScrollCurrentCellInView property can be used.
C#
//Allow scroll for current cell view
this.gridControl1.AllowScrollCurrentCellInView = GridScrollCurrentCellReason.Activate;VB
'Allow scroll for current cell view
Me.gridControl1.AllowScrollCurrentCellInView = GridScrollCurrentCellReason.Activate3. Alpha Blend Selection Color
In order to have desired selection color, the AlphaBlendSelectionColor property is used to set the specified color.
C#
//Set Alpha Blend Selection Color
this.gridControl1.AlphaBlendSelectionColor = Color.OrangeRed;VB
'Set Alpha Blend Selection Color
Me.gridControl1.AlphaBlendSelectionColor = Color.OrangeRed
4. ClickedOnDisabledCellBehavior
In order to change the disabled grid cell behavior on cell click, the ClickedOnDisabledCellBehavior property can be used.
C#
//Define the current cell behavior when disabled cell is clicked
this.gridControl1.ClickedOnDisabledCellBehavior = GridClickedOnDisabledCellBehavior.Default;VB
'Define the current cell behavior when disabled cell is clicked
Me.gridControl1.ClickedOnDisabledCellBehavior = GridClickedOnDisabledCellBehavior.Default5. Show Current Cell Border Behavior
In order to display the border of the current cell, the ShowCurrentCellBorderBehavior property can be used.
C#
//Show current cell border behavior
this.gridControl1.ShowCurrentCellBorderBehavior = GridShowCurrentCellBorder.HideAlways;VB
'Show current cell border behavior
Me.gridControl1.ShowCurrentCellBorderBehavior = GridShowCurrentCellBorder.HideAlways
6. Default Grid Border Style
In order to change the border style of the grid cells, the DefaultGridBorderStyle property can be used.
C#
//Set default grid border style
this.gridControl1.DefaultGridBorderStyle = GridBorderStyle. DashDotDot;VB
'Set default grid border style
Me.gridControl1.DefaultGridBorderStyle = GridBorderStyle. DashDotDot
Samples:
Conclusion
I hope you
enjoyed learning about how to set grid model options in WinForms
GridControl.
You can refer to WinForms GridControl feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms GridControl example to understand how to create and manipulate data.
For current customers, you can check out our 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 other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!