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.

GridGroupingControl - Selected Row Color

Thread ID:

Created:

Updated:

Platform:

Replies:

50797 Oct 19,2006 04:26 AM Sep 18,2018 08:37 AM Windows Forms 3
loading
Tags: GridControl
Badri Rajani Kanth
Asked On October 19, 2006 04:26 AM

Hi,

We are using V 4.2.0.37.

Our GGC control has some columns being displayed in different colors. We are setting these colors conditionally in QueryCellStyleInfo event.

But when we select the row, as row selection color is blue, blue color is overriding the column colors. What is the fix for this?

While grid is applying blue color, can I prevent it for certain cells?

Rgds
Rajani kanth

Administrator [Syncfusion]
Replied On October 19, 2006 12:35 PM

Hi Rajani,

You can change the row selection backcolor to any color you wish using the below piece of code.
//
this.gridGroupingControl1.TableOptions.SelectionBackColor = Color.Green;
//

Thanks,
Rajagopal

Nagaraju Dhulipalla
Replied On September 17, 2018 12:09 PM

this.gridGroupingControl1.TableOptions.SelectionBackColor = Color.Green;

using the above code, did not solve the problem mentioned below

Our GGC control has some columns being displayed in different colors. We are setting these colors conditionally in QueryCellStyleInfo event.

But when we select the row, as row selection color is blue, blue color is overriding the column colors. What is the fix for this?

While grid is applying blue color, can I prevent it for certain cells?

Mohanraj Gunasekaran [Syncfusion]
Replied On September 18, 2018 08:37 AM

Hi Nagaraju, 
 
Thanks for using Syncfusion product. 
 
To avoid the selection back color override your conditional styling, you could disable the SupportsPrepareViewStyleInfo and use the QueryCellStyleInfo event to set the selection BackColor for other columns. Please refer the following code example and the sample, 
 
Code example 
this.gridGroupingControl1.TableControl.SupportsPrepareViewStyleInfo = false; 
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
{ 
    if (e.TableCellIdentity == null || e.TableCellIdentity.Column == null) 
        return; 
    GridCurrentCell currentCell = this.gridGroupingControl1.TableControl.CurrentCell; 
    if (e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record) 
    { 
        if (e.TableCellIdentity.Column.Name == "Name" && e.TableCellIdentity.RowIndex % 3 == 0) 
        { 
            e.Style.BackColor = Color.Yellow; 
            e.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Yellow); 
        } 
        else if (e.TableCellIdentity.DisplayElement.GetRecord().IsSelected() 
            && currentCell.ColIndex != e.TableCellIdentity.ColIndex) 
        { 
            //To set the backcolor for selected records 
            e.Style.BackColor = this.gridGroupingControl1.TableOptions.SelectionBackColor; 
            e.Style.TextColor = Color.White; 
        } 
    } 
} 
 
 
Regards, 
Mohanraj G 


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.

;