Search code examples
c#imagedevexpressgridcontrol

TileView Image Column Not Show image (Devexpress)


i have gridControl on my form that converted to Tileview Layout and i want to show my data from database to tileview, my problem is that my image not show and just show its bytes.how i can fix this? i used repository.Edit.Picturebox but problem exist.enter image description here


Solution

  • Refer this- Grid Control - (converted to TileView) - How to show an image column

    Columns are automatically created when you assign a data source to a grid. Populate tile items based on these columns manually by using the Grid Designer. Your image will be shown properly if your column type is Image or Byte[].

    Approach which I have used is that I have created a separate column my datasource which contain byte array as shown in below code snippet:

    templateRow[TableColumnName.ImagePath] = finalPath;
    templateRow[TableColumnName.Image] = DevExpress.XtraEditors.Controls.ByteImageConverter.ToByteArray(
                                        System.Drawing.Image.FromFile(finalPath), System.Drawing.Imaging.ImageFormat.Png);
    

    There are several different ways to display icons in cells. Please review the How to put an image in a grid cell article, which demonstrates several possible approaches related to this task.

    References:
    Tile View not loading image from column containing Image Path
    byte array column to image display