Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Grid layout and (complex?) data binding

MarcinJMarcinJ USMember ✭✭

Hello,
I'm trying to build an app which will display a week view and will populate individual cells based on date & category.
I have built layout below using grid layout and managed to set dates for each columns and categories for each row (categories are static).
Now I would like to retrieve data for each cell (e.g. Category 1 & 16/09, Category 2 and 16/09, etc...).

Is there a simple way to bind data based on parameters (date and category) instead of doing something like below for each cell?
Cell 1 - <Label Text="{Binding Category1Day1}" />, Cell 2 - <Label Text="{Binding Category1Day2}" />, etc...

Maybe there is a better solution than the above Grid layout?

Thank you,
Marcin

Best Answer

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I think you have to use a Listview where each row has its Model and you can use Binding to retrive values

  • MarcinJMarcinJ USMember ✭✭

    Hi @AlessandroCaliaro and @LeonLu,
    Thank you for your help with this query.

    One more question, will it be possible to get day/category value from the list above?
    For example when I click on Category 5 row and 18/09 column I would like to get those values (category and date) so I can navigate users to appointment details. At the moment I can only get category value when I click on a row.

    Can this be done or do I gave to comeback to my grid view and populate each cell individually?

    Thanks,
    Marcin

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I think you should add a TapGestureRecognizer to each label so you know which "row-cols" you have tapped

Sign In or Register to comment.