Articles in this section

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

Activating current cell in WinForms Grid


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.Activate

3. 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

Alpha blend selection color in WinForms Grid


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.Default

5. 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

Current cell border in WinForms Grid


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

Border style in WinForms Grid


Samples:

C#: GridModelOptions_CS

VB: GridModelOptions_VB

 

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 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