Style for a drop down GridListControl

How can I change the style (ex: backcolor) of a GridListControl that is showed by a gridListControl cell?

3 Replies

AD Administrator Syncfusion Team May 15, 2003 03:17 PM UTC

You can handle the gridListControl.Grid.PreparepareViewStyleInfo event, and based on the e.ColIndex and e.RowIndex, set e.Style.BackColor.


MB Martin Brodeur May 15, 2003 04:48 PM UTC

Bu when i add a GridListControl to a GridBoundColumn this way : --------------------------- col = New GridBoundColumn col.MappingName = "IdEmployee" With col.StyleInfo .CellType = "GridListControl" .DisplayMember = DataSet12.Employees.EmployeeNamecolumn.ColumnName .ValueMember = DataSet12.Employees.EmployeeIdColumn.ColumnName .DataSource = DataSet12.Employees End With --------------------------- I don't have access to the avents raised by the GridListControl?


AD Administrator Syncfusion Team May 15, 2003 05:51 PM UTC

I am sorry I missed the part about the grid cell. To get at the embedded GridListControl in a cell to hook its grid's prepareviewstyleinfo, you can use code like this in your FormLoad: Dim cellRenderer As GridDropDownGridListControlCellRenderer = Me.gridControl1.CellRenderers("GridListControl") Dim gridList As GridListControl = cellRenderer.ListControlPart AddHandler gridList.Grid.PrepareViewStyleInfo, AddressOf gridlist_PrepareViewStyleInfo Then the handler can do soemthing like: Private Sub gridlist_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs) If e.RowIndex Mod 2 = 1 Then e.Style.BackColor = Color.LightCoral End If End Sub This code will change the backcolor everytime the gridlistcontrol is shown.

Loader.
Up arrow icon