Search code examples
c#xamarinxamarin.formsxamarin-studio

Xamarin forms: Display and bind data for list/grid with multiple rows and columns


I want to display multiple columns (2) and multiple rows. Data consists of Image and label. Can anyone suggest a way todo it or provide a sample code. I find it challenging as to know, how to bind the data with multiple rows.

I do not have any code to show as I am not able to come up with anything close to what I want to acheive.


Solution

  • You could consider the RepeaterView control (https://github.com/XLabs/Xamarin-Forms-Labs/wiki/RepeaterView) that allows you to bind a control template (e.g. consisting of an Image and Label) to a set of objects as bound or set to the ItemsSource property - it will then create an instance of the control template for every item in the collection, and any binding references within the control template will relate to the individual items in the collection. This is easy to include in your project in isolation.

    Alternatively if your requirements are more involved I would recommend the free DevExpress grid component (https://components.xamarin.com/view/devexpress-grid).