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
close icon

Grid Control and Drop Down list control Background Color

Hey, Need to know how to avoid the change in the background color when I click the GridListControl. the problem is when I select a particular row, the selected color is automatically set to Black and this sets the background color of the GridList control to black but keeps the forecolor as well to black and this makes the readability to zero. Now, how can I set the selection color of the grid and avoid it from auto setting to Black. thanks & regards, Montesh

2 Replies

AD Administrator Syncfusion Team April 25, 2006 04:27 AM UTC

Hi Montesh, You need to handle the Grid''s CurrentCellShowingDropDown and ListControlPart.Grid ''s PrepareviewStyle event .Here is a code snippet. private void gridControl1_CurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellShowingDropDownEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer; if(cr != null) { cr.ListControlPart.Grid.PrepareViewStyleInfo +=new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); } } private void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { e.Style.BackColor = Color.YellowGreen; } Let me know if this helps. Regards, Haneef


AD Administrator Syncfusion Team April 25, 2006 04:43 AM UTC

Hi Montesh, The selection behavior of the grid can be defined using the AllowSelection property. (Grid.AllowSelection = GridSelectionFlags.Row|GridSelectionFlags.AlphaBlend;) And the alpha blend selection color can be set using the AlphaBlendSelectionColor property. Please refer to the sample for more details. Let us know if you need any further assistance. Regards, Calvin.

43498.zip

Loader.
Live Chat Icon For mobile
Up arrow icon