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

Images not showing after grouping

Thread ID:





148627 Oct 28,2019 03:02 PM UTC Oct 29,2019 07:13 AM UTC WinForms 1
Tags: SfDataGrid
Asked On October 28, 2019 03:07 PM UTC

Dear Syncfusion,

After my previous post (https://www.syncfusion.com/forums/148556/gridimagecolumn-not-working) I tried to group the content of my grid and mostly it works only the images are not showing.

Before grouping:

After grouping:
"this.sfDataGrid1.GroupColumnDescriptions.Add(new GroupColumnDescription() { ColumnName = "DocumentName" });"

How can I group by "Document name" and still show the country flag image in the Country column?

PS: The project is a simple Windows Forms Project using C# with a single sfDataGrid in it. Basically it's the same project as in my previous question (linked above)
PS PS: Change the paths of the images inside VerwerkingsInfoCollection.cs to make it work on your computer.

Attachment: UpdateMasterExcelDocument_dafa884f.zip

Mohanram Anbukkarasu [Syncfusion]
Replied On October 29, 2019 07:13 AM UTC

Hi Dimitri, 

Thanks for contacting Syncfusion support. 

We have checked the reported scenario. You can resolve this by considering the group column description count while specifying the column index to draw the image as shown in the following code example. 

Code example

void sfDataGrid_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e) 
    if (e.DataRow.RowType == RowType.DefaultRow && e.ColumnIndex == this.sfDataGrid.GroupColumnDescriptions.Count + 1) 
        e.Handled = true; 
        e.Graphics.DrawImage(Image.FromFile(@"../../US.jpg"), new Rectangle(e.Bounds.X + 50, e.Bounds.Y + 2, e.Bounds.Width - 100, e.Bounds.Height - 5)); 
        Pen borderPen = new Pen(Color.LightGray); 
        e.Graphics.DrawLine(new Pen(e.Style.Borders.Right.Color), e.Bounds.Right - 1, e.Bounds.Top, e.Bounds.Right - 1, e.Bounds.Bottom); 
        e.Graphics.DrawLine(new Pen(e.Style.Borders.Bottom.Color), e.Bounds.Left, e.Bounds.Bottom - 1, e.Bounds.Right, e.Bounds.Bottom - 1); 


Please refer the sample from the following link. 

Please let us know if you need further assistance from us. 

Mohanram A. 


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

Live Chat Icon For mobile
Live Chat Icon