Add Image for grid cell

Posted by: nilekapawan on 8 August 2017, 1:40 am EST

  • Posted 8 August 2017, 1:40 am EST

    i want to add some image for some cells in one of flex grid column.And also i want to set that image as a clickable to add image to the cell?
  • Replied 8 August 2017, 1:40 am EST


    There are a couple ways to add images to a cell in the FlexGrid:

    1. Use a CellTemplate to define the content of the cell.

    Examples of using a cell template can be found in the FlexGrid101 sample "CustomCellsActivity".

    This blog post explains how to use custom cells in Xamarin.Forms. The approach is similar in Android, except all implementation is in code.

    2. Create a custom itemFormatter class and override the formatItem method. You will also need to set the FlexGrid's itemFormatter by calling the setItemFormatter() method and setting it to the custom ItemFormatter class.




    private ItemFormatter myItemFormatter = new ItemFormatter()
    public String formatItem(GridPanel gridPanel, FlexGridCanvasRenderEngine renderEngine, GridCellRange cellRange, Rect bounds)
    // set cell content here


    From a sample implementation, refer the FlexGrid101 sample "OnDemandActivity".

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels