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

How to set image in dropdown GridListControl cell in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl

Images in dropdown

In GridGroupingControl, you can set the images for dropdown GridListControl by handling the TableControlCurrentCellShowingDropDown to get the GridListControl dropdown and PrepareViewStyleInfo event of dropdown GridListControl to set the images.



//Event subscription
this.gridGroupingControl1.TableControlCurrentCellShowingDropDown += gridGroupingControl1_TableControlCurrentCellShowingDropDown;

//Handling the PrepareViewStyleInfo event
void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventArgs e)
    if ((e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent is GridDropDownGridListControlCellRenderer))
        (e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent as GridDropDownGridListControlCellRenderer).ListControlPart.ShowColumnHeader = false;
        //Event subscription.
        (e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent as GridDropDownGridListControlCellRenderer).ListControlPart.Grid.PrepareViewStyleInfo += Grid_PrepareViewStyleInfo;
//Set the images in DropDown GridListControl
private void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
    if (e.ColIndex == 1)
        e.Style.ImageList = imageList2;
        if (e.RowIndex > 0)
            e.Style.ImageIndex = (e.RowIndex - 1) % imageList2.Images.Count;



'Event subscription
Private Me.gridGroupingControl1.TableControlCurrentCellShowingDropDown += AddressOf gridGroupingControl1_TableControlCurrentCellShowingDropDown
'Handling the PrepareViewStyleInfo event
Private Sub gridGroupingControl1_TableControlCurrentCellShowingDropDown(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventArgs)
      If (TypeOf e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent Is GridDropDownGridListControlCellRenderer) Then
         TryCast(e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent, GridDropDownGridListControlCellRenderer).ListControlPart.ShowColumnHeader = False
            'Event subscription.
            AddHandler TryCast(e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent, GridDropDownGridListControlCellRenderer).ListControlPart.Grid.PrepareViewStyleInfo, AddressOf Grid_PrepareViewStyleInfo
      End If
End Sub
'Set the images in DropDown GridListControl
Private Sub Grid_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs)
      If e.ColIndex = 1 Then
            e.Style.ImageList = imageList2
            If e.RowIndex > 0 Then
                    e.Style.ImageIndex = (e.RowIndex - 1) Mod imageList2.Images.Count
            End If
      End If
End Sub


Images in dropdown GridListControl cell


C#: Images_In_DropDown

VB: Images_In_DropDown

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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

Live Chat Icon For mobile