We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Formatting multiple - selected cells

Thread ID:





61868 Jun 4,2007 12:11 PM UTC Jun 4,2007 05:18 PM UTC WinForms 1
Tags: GridControl
Vivek Vashisht
Asked On June 4, 2007 12:11 PM UTC

I am using a Grid Control and have set the property
this.gridControl1.AllowSelection = GridSelectionFlags.Any;

I am able to select multiple cells using the ctrl key but when I try to format all the selected cells, it is applied only to the last selected cell
Can you please tell how to implement a format change to all the selected cells..


haneefm [Syncfusion]
Replied On June 4, 2007 05:18 PM UTC

Hi Vivek,

You can hanlde the PrepareViewStyleInfo event to format the selected cells in a grid. Here is a code snippet that show this task:

private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
GridControl grid = sender as GridControl;
if( grid.Model.Selections.Ranges.AnyRangeIntersects(GridRangeInfo.Cell(e.RowIndex,e.ColIndex))
|| ( grid.CurrentCell.RowIndex == e.RowIndex && grid.CurrentCell.ColIndex == e.ColIndex ) )
e.Style.TextColor = Color.YellowGreen;

Best regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon