How to set image in dropdown GridListControl cell in WinForms GridGroupingControl?
Images in dropdown
In WinForms 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.
C#
//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;
}
} VB
'Event subscription
AddHandler 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 SubThe
screenshot below illustrates the Images in the Dropdown

Samples: