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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGroupingControl BackColor Transparency Problem

Thread ID:

Created:

Updated:

Platform:

Replies:

50503 Oct 12,2006 04:52 PM UTC Oct 18,2006 01:46 PM UTC WinForms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On October 12, 2006 04:52 PM UTC

I''ve been trying to get the GridGroupingControl in v4.2 to work correctly with colors.

For what ever reason, the GGC does not take the parents back color when it is added to a ControlCollection. Instead it defaults to SystemColors.Window This means that no matter what I do, I can''t get the GGC to take on the parent''s backColor.

The only way to make it work properly is to override OnParentChanged, and set the BackColor in there.

This has the interesting side effect of making OnBackColorChanged called twice, once from setting the backcolor in OnParentChanged once from the private method AssignParent(defined in Control). In the included example, you can this when commenting and uncommenting the line "BackColor = Parent.BackColor" in MyGGC.cs

Grid14.zip

Administrator [Syncfusion]
Replied On October 12, 2006 08:28 PM UTC

Hi Matthew,

Please refer this forum thread
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=50153

Let us know if this helps.
Thanks,
Rajagopal

Administrator [Syncfusion]
Replied On October 13, 2006 10:15 AM UTC

It doesn''t work. The back color never gets changed from Color.Window to the BackColor of the containing control.

This isn''t so much about transparency as it is about the GGC taking on the color of the parent control like it should normally.

>Hi Matthew,

Please refer this forum thread
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=50153

Let'>http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=50153''>http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=50153

Let us know if this helps.
Thanks,
Rajagopal

Administrator [Syncfusion]
Replied On October 16, 2006 05:47 AM UTC

Hi Matthew,

There is no built-in support for this. But you can derive the GridGroupingControl and override the OnParentBackColorChanged method to enable this. Below is a code snippet

public class MyGGC : GridGroupingControl
{
public MyGGC()
{}
protected override void OnParentBackColorChanged(EventArgs e)
{ base.OnParentBackColorChanged (e);
BackColor = Parent.BackColor; }
}

Let me know if this works.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On October 16, 2006 01:06 PM UTC

This works, but is a rather ugly hack considering that when deriving from a control you get this behavior for free. Why was behavior overridden?

Administrator [Syncfusion]
Replied On October 17, 2006 01:05 PM UTC

Hi Matthew,

I have consulted the development team regarding this issue and will let you know the details on this soon.

Thanks for your patience.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On October 18, 2006 01:46 PM UTC

Hi Matthew,

To make the GridGroupingControl reset its backcolor (and hence inherit the backcolor of its parent) by calling,
this.gridGroupingControl1.ResetBackColor();

So, you can make it inherit the color without deriving anything. (Note, the ResetBackColor method is inherited from Control and does not show up in intellisense, but it is valid.)

The reason the gridgroupingcontrol forces the backcolor is to prevent the default grid from showing cells with SystemColors.Control as their backcolors, since this would not be the desired color as default by the users.

Thanks,
Rajagopal


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

;