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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Image ComboBox in a cell

Thread ID:





103510 May 8,2012 08:15 PM UTC May 11,2012 08:58 AM UTC WinForms 1
Tags: GridControl
Adam Labranche
Asked On May 8, 2012 08:15 PM UTC

I have a GridDataBoundGrid with a BindingList<T> as its data source. For a specific column, I want to be able to select an icon using a combobox. Currently, it works well. I use a GridDropDownGridListControlCellRenderer to render the dropdown with the images and their information.

The only thing that I'm missing is that when the dropdown is closed, I only see the display string and not the icon in the closed combobox. How could I have a combobox that displays the icons with the choices and with the selected choice when the combobox is closed?

My current solution is to add an uneditable column right beside the column with the combo box that would display the icon of the selected choice, but I'd like to know if there's a better way.

Here's a sample of the code I'm using:

When the form is loaded:
      // We initialize the control for the color column.

      GridDropDownGridListControlCellRenderer colorComboBoxRenderer = ( GridDropDownGridListControlCellRenderer ) gridDataBoundGridIndicationList.CellRenderers["GridListControl"];

      // We hide the column header, the horizontal lines and the vertical lines

      // in the drop down grid list control to make it look like a normal combo box.

      colorComboBoxRenderer.ListControlPart.Grid.Properties.ColHeaders = false;

      colorComboBoxRenderer.ListControlPart.Grid.Properties.DisplayHorzLines = false;

      colorComboBoxRenderer.ListControlPart.Grid.DisplayVerticalLines = false;

      // We bind the indication colors' information to the grid list control for the color selection.

      gridBoundColumnColor.StyleInfo.CellType = "GridListControl";

      gridBoundColumnColor.StyleInfo.DataSource = IndicationListManagerUtil.GetColorDisplayableInformations();

      gridBoundColumnColor.StyleInfo.DisplayMember = "UserString";

      gridBoundColumnColor.StyleInfo.ValueMember = "Color";

      gridBoundColumnColor.StyleInfo.ImageList = imageListColors;

On CurrentCellShowingDropDown:

      GridCurrentCell currentCell = gridDataBoundGridIndicationList.CurrentCell;

      if ( currentCell.ColIndex == ColumnIndexColor && currentCell.Renderer.GetType() ==  typeof( GridDropDownGridListControlCellRenderer ) )


        GridDropDownGridListControlCellRenderer renderer = ( GridDropDownGridListControlCellRenderer ) currentCell.Renderer;

        // We set the width to the icon's width so the IndicationColor.ToString() doesn't show up.

        renderer.ListControlPart.Grid.ColWidths[1] = 16;


On CurrentCellCloseDropDown:

      GridCurrentCell currentCell = gridDataBoundGridIndicationList.CurrentCell;

      if ( currentCell.Renderer is GridDropDownGridListControlCellRenderer )


        GridDropDownGridListControlCellRenderer renderer = ( GridDropDownGridListControlCellRenderer ) currentCell.Renderer;

        renderer.ListControlPart.Grid.Properties.ColHeaders = false;

        if ( e.PopupCloseType == Syncfusion.Windows.Forms.PopupCloseType.Done && renderer.ToString() == "GridDropDownGridListControlCellRenderer" )


          // Set the image to the current cell.

          gridDataBoundGridIndicationList[currentCell.RowIndex, currentCell.ColIndex].ImageIndex = renderer.ListControlPart.SelectedIndex;



Asarudheen S [Syncfusion]
Replied On May 11, 2012 08:58 AM UTC

Hi Adam,

Thanks for being patient.

Please make use of the method “currentcell.EndEdit()” to resolve the reported issue “when the dropdown is closed, the icon is not displayed in the closed combobox” and refer the following code.

void gridDataBoundGrid_CurrentCellCloseDropDown(object sender, Syncfusion.Windows.Forms.PopupClosedEventArgs e)


            GridCurrentCell currentcell = this.gridControl1.CurrentCell;

              GridDropDownGridListControlCellRenderer renderer = ( GridDropDownGridListControlCellRenderer ) currentcell.Renderer;


            if (e.PopupCloseType == Syncfusion.Windows.Forms.PopupCloseType.Done)


                this.gridDataBoundGrid[currentcell.RowIndex, currentcell.ColIndex].ImageIndex = renderer.ListControlPart.SelectedIndex;




Please let us know if this helps.




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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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