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. Image for the cookie policy date

GridGroupingControl Header ForeColor

Hi,

I can't seem to change the color of the header cell.. even after following the examples.

  • ui_GridGroupingControl_Apple.ThemesEnabled = False
  • Me.ui_GridGroupingControl_Apple.Appearance.ColumnHeaderCell.Themed = False
  • Me.ui_GridGroupingControl_Apple.Appearance.ColumnHeaderCell.CellTipText = "ColumnHeader"
  • Me.ui_GridGroupingControl_Apple.Appearance.ColumnHeaderCell.Interior = New BrushInfo(GradientStyle.Vertical, Color.FromArgb(214, 220, 232), Color.FromArgb(106, 111, 151))
  • Me.ui_GridGroupingControl_Apple.Appearance.ColumnHeaderCell.TextColor = Color.White

The header cell always shows a default grey color for the text. Using the designer, I can't change the interior foreColor values as well. It defaults to Window




5 Replies

VK Vinish Kumar K Syncfusion Team October 18, 2012 05:38 AM UTC

Hi John,

 

Thanks you for your interested in Syncfusion products.

 

Query

Column Header color

You can set the header color in GridGroupingControl using the QueryCellStyleInfo event. Here you can the set the color for header. Please refer the following codes.

 

Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)

 

                     If e.TableCellIdentity.TableCellType = GridTableCellType.GroupCaptionCell Then

                           e.Style.CellType="Static"

                           e.Style.BackColor=Color.Blue

                           e.Style.TextColor = Color.White

                     End If

 

                     If e.TableCellIdentity.TableCellType = GridTableCellType.ColumnHeaderCell Then

                           e.Style.TextColor = Color.White

                           If e.TableCellIdentity.Column.MappingName="Col0" Then

                                  e.Style.CellType = "Static"

                                  e.Style.BackColor = Color.SteelBlue

                           End If

                           If e.TableCellIdentity.Column.MappingName = "Col1" Then

                                  e.Style.CellType = "Static"

                                  e.Style.BackColor = Color.Green

 

                           End If

                          

 

                     End If

              End Sub

 

 

Please refer the following sample file also it will helps to you. See thee below image of GGC out put

 

 

 

 

Please let me know if you have further concerns.

 

Regards,

Vinish.



Header color_674df11e.zip


JO John October 18, 2012 12:00 PM UTC

Hi Vinish,

Awesome mate. That worked.

Now, referring to your sample project,

Using, QueryCellStyleInfo, The mouse-over colors and sort direction icons do not appear.

How do I implement those or keep that intact?

Cheers,
Ash








VK Vinish Kumar K Syncfusion Team November 13, 2012 11:12 AM UTC

Hi Ash,

 

Thanks for your update.

 

Query

 

Mouse Over Color

To set the mouse over color, you can use the following events. Using this event you can set the mouse over color on enter and leaving in cell. Use these events CellMouseHoverEnter And CellMouseHoverLeave. Please refer the attached sample also it will helps to you to set the color on mouse over in header.

Query 2

Sorting icon in Static Cell

You can set the icon in Column header using the DrawCell event and DrawCellDisplayText event. Please refer the below codes.

void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)

    {

        GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;

        if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell && style.TableCellIdentity.Column.Name =="Concat" )

        {

           

            // Draw Sort-Arrow

            Brush brush = null;

            Pen pen1 = null;

            e.TableControl.Model.Options.GridVisualStylesDrawing.GetSortIconBrush(out brush, out pen1);

            Rectangle rect = e.Inner.ClipBounds;

            rect.Offset(e.Inner.ClipBounds.Width - 20, 0);

            rect.Width = 20;

            int i2 = Math.Max(0, (rect.Height - 3) / 2);

            rect.Inflate(-10, -10);

            ListSortDirection listSortDirection = ListSortDirection.Ascending;

            GridTriangleDirection triangleDirection = listSortDirection == ListSortDirection.Ascending ? GridTriangleDirection.Up : GridTriangleDirection.Down;

            GridPaintTriangle.Paint(e.Inner.Graphics, rect, triangleDirection, brush, pen1, true);

            pen1.Dispose();

            brush.Dispose();

        }

    }

 

Please refer the sample file also. It will helps to you to modify your sample.

 

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

 

And also refer the following UG Link it will helps to you to more details about drawCell and draw icon.

 

http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Grid/default.htm#!Documents/414135customdrawing.htm

 

 

Please let me know if you have further concerns.

 

Regards,

Vinish.


Grid Cursor Test_b402929b.zip



GM Gaukhar Massabayeva December 12, 2012 11:07 AM UTC

Hello. Is it possible to provide Grid Cursor Test in c#? Thank you


VK Vinish Kumar K Syncfusion Team December 12, 2012 04:08 PM UTC

Hi Gaukhar Massabayeva,

 

Thank you for your interested in Syncfusion products.

As per request we have modified the sample to C#. Please find the attached sample with this forum.  You can set the mouse over color on enter and leaving in cell. Use these events CellMouseHoverEnter And CellMouseHoverLeave to achieve the desired behavior.

Please let me know if you have further concerns.

Regards,

Vinish.



Helighting Row and Col header while hovering mouse on cell_2f67b3cd.zip

Loader.
Live Chat Icon For mobile
Up arrow icon