GridGroupingControl - Selected Row Color
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
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
SIGN IN To post a reply.
3 Replies
AD
Administrator
Syncfusion Team
October 19, 2006 04:35 PM UTC
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
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
ND
Nagaraju Dhulipalla
September 17, 2018 04:09 PM UTC
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?
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?
MG
Mohanraj Gunasekaran
Syncfusion Team
September 18, 2018 12:37 PM UTC
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
SIGN IN To post a reply.
- 3 Replies
- 4 Participants
-
BR Badri Rajani Kanth
- Oct 19, 2006 08:26 AM UTC
- Sep 18, 2018 12:37 PM UTC