GridGroupingControl question

Hi,

I am working on this control. I had few questions related with control. Hopefully you will be able to answer them.

1. If I want to change the color of the selected row in this control how should I do that. Default it is showing me orange color. I would like it to change to blue
2. If I want to change the text color of elements in the selected row , how do I do that. Default color it is showing me white. I would like it to turn to black .
3. The group header when clicked turns to color black. Is it possible to change the color of it?


Are there any properties or functions I need to setup?


-Anuvrat


1 Reply

NA Nisha Arockiya A Syncfusion Team September 29, 2008 12:59 PM UTC


Hi Anuvrat,

Thanks for your interest in Syncfusion Products.

Query 1:

You have to include the Alphablend flag in the Allowselection property. To control the selection color better, you can turn off the color in alhablend selection color and handle PrepareViewStyleInfo.
Here is some code snippet:


// In Form Load
this.gridGroupingControl1.TableModel.Options.AlphaBlendSelectionColor = Color.FromArgb(0,0,0,0);
this.gridGroupingControl1.TableModel.Options.AllowSelection = (Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Row | Syncfusion.Windows.Forms.Grid.GridSelectionFlags.AlphaBlend);

// PrepareViewStyleInfo
private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlPrepareViewStyleInfoEventArgs e)
{
if(this.gridGroupingControl1.TableControl.Selections.Ranges.AnyRangeContains(GridRangeInfo.Cell(e.Inner.RowIndex, e.Inner.ColIndex)) && !this.gridGroupingControl1.TableControl.CurrentCell.IsEditing) e.Inner.Style.BackColor = Color.Blue;
}


Query 2:

Handle the same PrepareViewStyleInfo as above and set the text color of the selected row.
e.Style.TextColor = Color.Black;

Query 3:

Inorder to change the color or the group header,Please try this code snippet and let us know if this helps.

private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.TableCellType==GridTableCellType.GroupCaptionCell)
{
e.Style.TextColor=Color.Red;
}
}

Please let me know if this helps.

Regards,
Nisha


Loader.
Up arrow icon