Designing image gallery in xamarin.forms

I have a JSON which contains image thumbnail URLS and some text now I have to render it as image gallery like phone gallery. I researched a lot about grid layout but didn't find a way to dynamically create numbers of grid of fixed width and height which can show images. Can any one tell me what will the best component to design gallery type page containing numbers of images?

You can use this nuget package and display Image in grid. Sample code for that:

<flv:FlowListView FlowColumnCount="3" SeparatorVisibility="None" HasUnevenRows="false"
FlowItemTappedCommand="{Binding ItemTappedCommand}" 
FlowItemsSource="{Binding PhotosList}" >
                        <Image Source="{Binding Image}" HeightRequest="50" WidthRequest="50"/>
                        <Label Text="{Binding Name}" TextColor="Black" FontSize="Medium" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" HorizontalOptions="Fill" />

Where PhotosList will be your list of your Url and Text.

Image Gallery Control using Xamarin Form, For Creating an image since you have mentioned it to be from an URL, the following syntax would help you: webImage. Source = new UriImageSource { Uri = new Uri(""), CachingEnabled = true, CacheValidity = new TimeSpan(5,0,0,0) }; Xamarin.Forms uses the Image view to display images on a page. It has two important properties: It has two important properties: Source - An ImageSource instance, either File, Uri or Resource, which sets the image to display.

There is a gallery control in Xamarin.Droid Please see the sample -

If this is not what you are looking for then You can use your own Listview with images. And onseletion you can show the full image. See sample of list view with images in xamarin.form examples.

If you need multiple column use stack layout in horizontal rendering and inside that list views, probably 3.

That will give you 3 columns and unlimited scrollable rows.

EDIT : You have to create a ViewModel that would have a class with public properties that you want to bind to. Deserialize your JSON into an IEnumerable of this ViewModel class and bind to your listview. Inside the Listview you have to use ImageCell

For Creating an image since you have mentioned it to be from an URL, the following syntax would help you:

  webImage.Source = new UriImageSource {
    Uri = new Uri(""),
    CachingEnabled = true,
    CacheValidity = new TimeSpan(5,0,0,0)

The employee example binds a ListView with one image and 2 labels.

class EmployeeCell : ViewCell
    public EmployeeCell()
        var image = new Image
                        HorizontalOptions = LayoutOptions.Start
        image.SetBinding(Image.SourceProperty, new Binding("ImageUri"));
        image.WidthRequest = image.HeightRequest = 40;

        var nameLayout = CreateNameLayout();

        var viewLayout = new StackLayout()
                             Orientation = StackOrientation.Horizontal,
                             Children = { image, nameLayout }
        View = viewLayout;

EDIT 2 : In case you have variable number of image URLs to be rendered then you will be better off going for a TableView. TableView isnt bound to a datasource and you can create individual cells as per your requirement by parsing the JSON object. ie : Each JSON object would be a TableSection and each Image would be a ImageCell

Images in Xamarin.Forms, Force Landscape or Portrait for a single page in Xamarin Form. Google Place API with Autocomplete in Xamarin Android · Material design  Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Designing image gallery in xamarin.forms. Ask

I ended up splitting my source JSON array into 3 columns using this code

return myGroupedGalleryDto.Select ((row, index) => new {row, index})
                    .GroupBy (g => g.index / 3, i => i.row)
                    .Select ((v, k) => new GalleryDto () {
                    Key = k,
                    Images = v.ToList ()
                }).ToList ();

and then in XAML,

<Grid x:Name="grid">
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
    <Image Grid.Column="0" Source="{Binding Images[0].MyImageUrl}" />
    <Image Grid.Column="1" Source="{Binding Images[1].MyImageUrl}" />
    <Image Grid.Column="2" Source="{Binding Images[2].MyImageUrl}" />

Using the following ViewModels

public class GalleryDto
    public int ID { get; set; }

    public string MyImageUrl { get; set; }

public class GroupedGalleryDto
    public int Key { get; set; }

    public List<GalleryDto> Images { get; set; }

Image Gallery View In Xamarin Android App Using Visual Studio 2015, Xamarin.Forms uses the Image view to display images on a page. different resolutions on different platforms, or slightly different designs. A lot of time has passed since my last post about how to implement an image gallery in Xamarin.Forms. At the time the best solution was to use an ImageGallery control provided by the awesome people of XLabs but since the release of Xamarin.Forms 2.3 we can finally use a more versatile control named CarouselView.

xaml - Designing image gallery in xamarin.forms, Choose the Designer Window, if you want to design so you can design your app. Xamarin Step 4. After opening the main.axml file will open the  This code is called when our Upload Images button is clicked and can be found in ImageSelectionPage.xaml.cs. (Lines 7–10, 25–30, and 46 displayed below are optional) (Lines 7–10, 25–30

Controls for Image gallery, xaml - Designing image gallery in xamarin.forms -. I have a JSON that has image thumbnail URLs and some text to present as an image gallery such as a phone  Select Multiple Images From Gallery in Xamarin Forms June 15, 2017 18 Comments — Before start reading this article, this solution has been deprecated, so please read this article with a new solution by XamBoy , Thanks 🙂 —

Get Images Slider From Web in Xamarin Froms, Forms. Hi,. migtht be a simple question but I am looking for a suitable control to show images like an image gallery. The images should be  The steps, mentioned below, are required to be followed in order to create the Image Gallery View in Xamarin Android app, using Visual Studio 2015. Step 1 Click File--> select New--> select Project. The project needs to be clicked after opening all the types of projects in Visual Studio or click (Ctrl+Shift+N). Step 2

  • yeah i can understand what you told but in the listview i can bind only one object of json in a cell how can i bind multible objects data in a single cell.
  • The Gallery control is for Android only, not Xamarin Forms
  • @Rohit - Every object of my JSON contains an image url, image title and date of capturing the image, when I bind the JSON to list view only single object's data can be rendered on row by row but when a row contains two images and detail behind those , How is it possible to bind two JSON object in single row at same time?
  • Do you mean your JSON object have multiple URLs?
  • @Rohit - No single URL but show multiple URL on each row.