Articles in this section
Category / Section

How to prevent the blackout selection in WinForms GridGrouping Control?

2 mins read

Selection backcolor

By default, the selected rows or columns or cells are highlighted with AlphaBlend color. The Selection Backcolor is highlighted with Black color, by changing the AllowSelection property to None. The following image illustrates the exact issue.

Show the backcolor while changing AllowSelection from Any to None

As per the architecture, the Selection Backcolor is removed from the graphics when changing AllowSelection to None. This article provides the information about how to resolve it.

Solution

To resolve the Selection Backcolor issue, the GridSelectionFlags.AlphaBlend property can be used along with the GridSelectionFlags.None property as GridSelectionFlags.None | GridSelectionFlags.AlphaBlend while setting the AllowSelection to None.

C#

private void noneAllowSelection_CheckedChanged(object sender, EventArgs e)
{
   //Sets the AllowSelection property to None
   this.gridGroupingControl1.TableOptions.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.None | Syncfusion.Windows.Forms.Grid.GridSelectionFlags.AlphaBlend;
}
private void anyAllowSelection_CheckedChanged(object sender, EventArgs e)
{
   //Sets the AllowSelection property to Any
   this.gridGroupingControl1.TableOptions.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Any;
}

VB

Private Sub noneAllowSelection_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles noneAllowSelection.CheckedChanged
   'Sets the AllowSelection property to None
   Me.gridGroupingControl1.TableOptions.AllowSelection =   Syncfusion.Windows.Forms.Grid.GridSelectionFlags.None Or Syncfusion.Windows.Forms.Grid.GridSelectionFlags.AlphaBlend
End Sub
Private Sub anyAllowSelection_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles anyAllowSelection.CheckedChanged
   'Sets the AllowSelection property to Any
   Me.gridGroupingControl1.TableOptions.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Any
End Sub

 

Note:

This is applicable for GridControl and GridDataBoundGrid also.

Screenshot

The following image illustrates the Selection Backcolor as a Default Selection Backcolor.

Show the backcolor while changing AllowSelection from Any to None

Samples:

C#: Selection_Backcolor_CS

VB: Selection_Backcolor_VB


Conclusion

I hope you enjoyed learning about how to prevent the blackout selection in WinForms GridGrouping Control.

You can refer to our WinForms GridGroupingControl 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 GridGroupingControl 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)
Please sign in to leave a comment
Access denied
Access denied