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

How to load an image for a column in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: February 15, 2016 |
Last Revised Date: January 1, 2020

Load an image for a column

To load an image for a column in grid grouping control, the following ways can be used,

1. QueryCellStyleInfo event.

2. Using Appearance property.

Using QueryCellStyleInfo event

In this method, the cell type of a column is changed to image cell and image can be loaded by adding an image to a list and assigned that list to ImageList Property. Particular image can be set by setting the Index of an image using ImageIndex Property.

C#

this.gridGroupingControl1.QueryCellStyleInfo += gridGroupingControl1_QueryCellStyleInfo;
 
void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
   if (e.TableCellIdentity.RowIndex > 2 && e.TableCellIdentity.ColIndex == 2)
   {
      e.Style.CellType = GridCellTypeName.Image;
     //image collection is stored in this list
     e.Style.ImageList= image;
     //index of the image to be added.
     e.Style.ImageIndex = 0;
   }
}

VB

AddHandler Me.gridGroupingControl1.QueryCellStyleInfo, AddressOf gridGroupingControl1_QueryCellStyleInfo
 
Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs)
   If e.TableCellIdentity.RowIndex > 2 AndAlso e.TableCellIdentity.ColIndex = 2 Then
      e.Style.CellType = GridCellTypeName.Image
       'image collection is stored in this list
      e.Style.ImageList= image
       'index of the image to be added.
      e.Style.ImageIndex = 0
   End If
End Sub

Using Appearance property

An image can be loaded for a column by setting Appearance.AnyRecordFieldCell.CellType to image cell for specific columns.

C#

this.gridGroupingControl1.TableDescriptor.Columns[1].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.Image; this.gridGroupingControl1.TableDescriptor.Columns[1].Appearance.AnyRecordFieldCell.ImageList = image; this.gridGroupingControl1.TableDescriptor.Columns[1].Appearance.AnyRecordFieldCell.ImageIndex = 0;

 

VB

Me.gridGroupingControl1.TableDescriptor.Columns(1).Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.Image
Me.gridGroupingControl1.TableDescriptor.Columns(1).Appearance.AnyRecordFieldCell.ImageList = image
Me.gridGroupingControl1.TableDescriptor.Columns(1).Appearance.AnyRecordFieldCell.ImageIndex = 0

 

Add images for the column

 

Samples:

C#: Loading an image_CS

VB: Loading an image_VB

Reference link: https://help.syncfusion.com/windowsforms/classic/gridgroupingcontrol/appearance-and-formatting

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
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
Live Chat Icon