Iterate through grid row, to get each child value in each cell, Xamarin Form

Maxime V 1 Reputation point
2021-02-05T13:06:36.237+00:00

Hello,

I didn't find any way to get all my row cell value in my grid, in my Xamarin form project.

I think the best way is to access to the child element in the row cell, and then get the value, but I am lost.

Thanks

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,326 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. John Hardman 261 Reputation points
    2021-02-05T17:35:36.893+00:00

    I'm not sure quite what you want to do, but given a Grid grid, the following will iterate through all the children of the Grid, getting the row and column of each. That should get you started.

    foreach (View view in grid.Children)
    {
    int row = Grid.GetRow(view);
    int column = Grid.GetColumn(view);
    }

    1 person found this answer helpful.
    0 comments No comments