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.
Unfortunately, activation email could not send to your email. Please try again.

Don''t hightlight cell when selecting rows

Thread ID:

Created:

Updated:

Platform:

Replies:

95070 Jun 18,2010 07:59 AM Jun 23,2010 10:22 AM Windows Forms 1
loading
Tags: GridControl
Steve Catterall
Asked On June 18, 2010 07:59 AM

I have a GridControl with ListBoxSelectionMode = SelectionMode.MultiExtended
When selecting rows the current cell (the cell the user clicks on) does not get the selection colour, and remains white.

Is there a way to turn this off, so the whole row gets highlighted when it is selected?

Christopher Issac Sunder K [Syncfusion]
Replied On June 23, 2010 10:22 AM

Hi Stephen,

Thank you for your interest in Syncfusion products.

Highlighting the selected row including current cell can be achieved by handling the PrepareViewStyleInfo event. In the given sample, the AlphaBlendSelectionColor property gives us the selection color.

this.gridControl1.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.gridControl1.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(gridControl1_PrepareViewStyleInfo);
this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell; //

void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
if (e.RowIndex == cc.RowIndex && e.ColIndex == cc.ColIndex && !cc.IsEditing)
{
e.Style.BackColor = this.gridControl1.AlphaBlendSelectionColor; // get the selection color.
}
}


Please refer the following sample which illustrates the above.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GC_CCColor1932988202.zip

Regards,
Christopher K.

CONFIRMATION

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.

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.

;