简体   繁体   中英

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.

You could consider the RepeaterView control ( https://github.com/XLabs/Xamarin-Forms-Labs/wiki/RepeaterView ) that allows you to bind a control template (eg 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 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM