You can also load the image by using GridTemplateColumn. The following screenshot illustrates the GridTemplateColumn “Pass or Fail” loaded with the corresponding images that are defined as a DataTemplate of that column.
Figure 1: SfDataGrid with image loaded in GridTemplateColumn
You cannot export the images to PDF document when it is loaded inside the GridTemplateColumn.
In that case, you can achieve it by customizing and assigning the same images to the background of PDFGridCell while exporting, with the help of CellsExportingEventHandler delegate of PdfExportingOptions. Refer to the following code example.
In the above code example, GridCellPdfExporting event handler is assigned to the CellsExportingEventHandler delegate and it is invoked while exporting each cell to PDF. Here, you can handle and customize each PdfGridCell while exporting, and GridCellPdfExportingEvent contains the following argument as a parameter.
Here, you can access the images from the resource file and you can set them to the background of PdfGridCell style as illustrated in the following code example.
The above GridTemplateColumn images are exported into PDF document as displayed in the following screenshot.
Figure 2: PDF View
This page will automatically be redirected to the sign-in page in 10 seconds.