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.
Syncfusion Feedback

Themes, Buttons and Header colors

Thread ID:

Created:

Updated:

Platform:

Replies:

45701 Jun 27,2006 01:54 PM UTC Jun 13,2007 11:26 PM UTC Windows Forms 4
loading
Tags: GridControl
Chris Wescott
Asked On June 27, 2006 01:54 PM UTC

Hi, I am using the 4.1 version of the GGC in a P-C releationship and I need to change the header backcolor. I am using this code below: GGC.TableDescriptor.Appearance.AnyHeaderCell.BackColor = mycolor however it only works when I have themes = false in design time. This is fine except I have buttons in my grid and would love to keep the more pop-up style button I get when themes are turned one. Is there a way to either keep the pop-up button style and turn the themes off or is there a way to keep the themes turned on and change the cell backcolor in a diffent way. Regards, Chris

Administrator [Syncfusion]
Replied On June 27, 2006 03:52 PM UTC

Hi Chris, The BackColor of a cell is normally controlled through the style.BackColor property of the cell. This should work for any cell unless you are handling some event that prevents this default behavior. This should n''t work for theme enabled header (RowHeader ,ColumnHeader) cells and buttons. You need to subscribe to the grid''''s TableControlDrawCell event for drawing the cells. There you can use e.Inner.Graphics.FillRectanlge to draw the backcolor and then set e.Inner.Cancel = true to indicate you have handled the drawing. Here is a sample that shows how you can use this event to draw backcolor in cells. http://www.syncfusion.com/Support/user/uploads/ThemeTable_51a1976b.zip One comment though is that the backcolor of buttons is not control through the style object for the cell. Instead, you will have to handle an event to color buttons. Here is a forum thread discussing coloring buttons. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=26772 Let me know if this helps. Best Regards, Haneef

Tod Golding
Replied On June 8, 2007 05:31 PM UTC

I'm experience this same problem and, after reading your response I'm still not sure clear about how this is supposed to get resolved.

If I have a theme enabled for a GGC and I want to simply "override" that theme's header backcolor, are you saying that can't be done without capturing an event and setting the cell color.

I want to use a theme and simply tweak some of the settings for that theme and I would like to do that by simply setting properties in the designer. Is that allowed?

Here's my specific example. I'm using stacked headers and want to set a different color for each stacked header. With EnableThemes disabled I can just edit the header appearance and this works just like I want it to. However, with themes turned on, I can't seem to do this. It would seem odd to suggest that I would have to write code to override the default settings that each column inherits from a theme.

>Hi Chris,
>
>The BackColor of a cell is normally controlled through the style.BackColor property of the cell. This should work for any cell unless you are handling some event that prevents this default behavior. This should n't work for theme enabled header (RowHeader ,ColumnHeader) cells and buttons. You need to subscribe to the grid''s TableControlDrawCell event for drawing the cells. There you can use e.Inner.Graphics.FillRectanlge to draw the backcolor and then set e.Inner.Cancel = true to indicate you have handled the drawing.
>
>Here is a sample that shows how you can use this event to draw backcolor in cells.
>http://www.syncfusion.com/Support/user/uploads/ThemeTable_51a1976b.zip
>
>One comment though is that the backcolor of buttons is not control through the style object for the cell. Instead, you will have to handle an event to color buttons.
>
>Here is a forum thread discussing coloring buttons. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=26772
>
>Let me know if this helps.
>Best Regards,
>Haneef
>
>
>
>

Tod Golding
Replied On June 13, 2007 05:04 PM UTC

Any word on this...?

>Hi Chris,
>
>The BackColor of a cell is normally controlled through the style.BackColor property of the cell. This should work for any cell unless you are handling some event that prevents this default behavior. This should n't work for theme enabled header (RowHeader ,ColumnHeader) cells and buttons. You need to subscribe to the grid''s TableControlDrawCell event for drawing the cells. There you can use e.Inner.Graphics.FillRectanlge to draw the backcolor and then set e.Inner.Cancel = true to indicate you have handled the drawing.
>
>Here is a sample that shows how you can use this event to draw backcolor in cells.
>http://www.syncfusion.com/Support/user/uploads/ThemeTable_51a1976b.zip
>
>One comment though is that the backcolor of buttons is not control through the style object for the cell. Instead, you will have to handle an event to color buttons.
>
>Here is a forum thread discussing coloring buttons. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=26772
>
>Let me know if this helps.
>Best Regards,
>Haneef
>
>
>
>

haneefm [Syncfusion]
Replied On June 13, 2007 11:26 PM UTC

Hi Tod,

You can also do this by setting these property GridTableCellStyleInfo.Themed and GridTableCellStyleInfo.BackColor. Below is a code snippet to show this.

//For column header cell backcolor.
this.gridGroupingControl1.TableDescriptor.Columns["ColumnName"].Appearance.ColumnHeaderCell.Themed = false;
this.gridGroupingControl1.TableDescriptor.Columns["ColumnName"].Appearance.ColumnHeaderCell.BackColor = Color.Red;

//For Stacked column header cell backcolor.
this.gridGroupingControl1.TableDescriptor.StackedHeaderRows["Row1"].Headers[1].Appearance.StackedHeaderCell.Themed = false;
this.gridGroupingControl1.TableDescriptor.StackedHeaderRows["Row1"].Headers[1].Appearance.StackedHeaderCell.BackColor = Color.AliceBlue;

Here is a minimal sample that shows you "How to set the backcolor to the column header/stackedcolumn header cell in a grid?"
StackedMultiheaders.zip

Suppose if you want to cahnge the column header backcolor for some specific group(condition based) then you need to handle the QueryCellStyleInfo event. Please let me know if this helps.

Best regards,
Haneef

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.

Warning Icon 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.Close Icon

;