Dear Syncfusion,
The platform I am using is indeed Winforms. And this is almost (about 90%) what I was searching for.
In your example on page Form1.cs in method sfDataGrid_DrawCell you are using:
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));
Only this line takes 1 specific image "../../US.jpg" and uses the same image for the whole column. And does not uses the provided Image data from VerwerkingsInfoCollection.cs. I have tried some things myself (see zip) but I can't manage to correct the method so that it uses the provided images.
PS: the variable "object sender" does have the correct data including the images that I need but if I make a foreach loop (see new zip) it just uses the last image in the for loop for the whole column.
EDIT: The second I posted this it occurred to me how to fix it. My apologies if you have read it before my edit.
This is how I changed the code for the people who have the same problem as I did and also want to solve it: The following line "this.sfDataGrid1.DrawCell += sfDataGrid_DrawCell;" uses a DrawCell event that fires for each cell that needs drawing. So if you change the "sfDataGrid_DrawCell" method to the following it will look for the right image in the DataSource.
void sfDataGrid_DrawCell(object sender, DrawCellEventArgs e)
{
int rowNr = e.RowIndex-1;
if (e.DataRow.RowType != RowType.HeaderRow && e.ColumnIndex == 1)
{
SfDataGrid sfDataGrid = (SfDataGrid)sender;
List dataSource = (List)sfDataGrid.DataSource;
Image image = dataSource[rowNr].Flag;
e.Handled = true;
e.Graphics.DrawImage(image, new Rectangle(e.Bounds.X + 50, e.Bounds.Y + 2, e.Bounds.Width - 100, e.Bounds.Height - 5));
//e.Graphics.DrawString(e.DisplayText, e.Style.GetFont(), new SolidBrush(e.Style.TextColor), new RectangleF(e.Bounds.X + 500, e.Bounds.Y + 10, e.Bounds.Width, 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);
}
}
Also: change all occurrences of "ObservableCollection" in VerwerkingsInfoCollection.cs to "List" (change ObservableCollection into List)
PS: Thanks for the solution and help.
Attachment:
MainForm_fe60e932.zip