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.

GLC Alternate Colors

Thread ID:

Created:

Updated:

Platform:

Replies:

36115 Oct 20,2005 07:19 AM Oct 23,2005 08:35 PM Windows Forms 7
loading
Tags: Grouping
KMS
Asked On October 20, 2005 07:19 AM

I have a GGC, with a GridlistControl in one of the TableDescriptor cells. I''m using the following to do alternate colors: GridTableCellStyleInfo style (GridTableCellStyleInfo) e.Inner.Style; if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell) { if (e.Inner.RowIndex > 1 && (e.Inner.RowIndex % 2) == 0) e.Inner.Style.BackColor = System.Drawing.Color.FromArgb(148, 207, 247); else e.Inner.Style.BackColor = System.Drawing.Color.FromArgb(255, 255, 255); } The GLC however, is all one color based on the current cell color. Thanks

Administrator [Syncfusion]
Replied On October 20, 2005 10:13 AM

Your code sets the colors in the GridGroupingControl. It does not try to set the colors in the embedded GridListControl of a cell. To do this, you can subscribe to the PrepareViwStyleInfo event in the Grid property of teh embedded GridListControl, and use that event to provide alternating colors to the dropdown. Here is code that you can use to subscribe to the event. GridDropDownGridListControlCellRenderer cr = this.gridGroupingControl1.TableControl.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);

KMS
Replied On October 21, 2005 08:55 AM

Hi Clay, I have added the code in the form load, but for some reason the event is not getting invoked. My Grid_PrepareViewStyleInfo function is not getting called when my GLC drops down. >Your code sets the colors in the GridGroupingControl. It does not try to set the colors in the embedded GridListControl of a cell. To do this, you can subscribe to the PrepareViwStyleInfo event in the Grid property of teh embedded GridListControl, and use that event to provide alternating colors to the dropdown. Here is code that you can use to subscribe to the event. > >GridDropDownGridListControlCellRenderer cr = this.gridGroupingControl1.TableControl.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; >cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); >

Doc1.zip

Administrator [Syncfusion]
Replied On October 21, 2005 12:06 PM

You are using the GridListControl from a nested table, not the parent table. So, you will have to get the TableControl diferently. The "ChildToGrandChild" used below is the name of the relation that ends at this TableControl. GridDropDownGridListControlCellRenderer cr = this.gridGroupingControl1.GetTableControl("ChildToGrandChild").CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);

KMS
Replied On October 22, 2005 05:56 PM

Thanks fo rthe response Clay, I''m not sure what''s going on at this point. As soon as the code GridDropDownGridListControlCellRenderer cr = this.plannedOrdersGridGroupingControl.GetTableControl("ChildToGrandChild").CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; is executed, I get the old: Object reference not set to an instance of an object error. >You are using the GridListControl from a nested table, not the parent table. So, you will have to get the TableControl diferently. The "ChildToGrandChild" used below is the name of the relation that ends at this TableControl. > >GridDropDownGridListControlCellRenderer cr = this.gridGroupingControl1.GetTableControl("ChildToGrandChild").CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; > cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); >

Administrator [Syncfusion]
Replied On October 23, 2005 04:16 AM

Here is a sample with that code working. http://www.syncfusion.com/Support/user/uploads/GGC_Nested_82eae08f.zip Check to make sure you are using the proper string ("ChildToGrandChild") in the GetTableControl call. It should be the relation name.

KMS
Replied On October 23, 2005 12:38 PM

I''m getting a "page not found" error on the sample zip file. >Here is a sample with that code working. > >http://www.syncfusion.com/Support/user/uploads/GGC_Nested_82eae08f.zip > >Check to make sure you are using the proper string ("ChildToGrandChild") in the GetTableControl call. It should be the relation name.

Administrator [Syncfusion]
Replied On October 23, 2005 08:35 PM

Try this link. http://www.syncfusion.com/Support/user/uploads/GGC_Nested_ab3e4c28.zip

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.

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.

;