Forum Cross Platform with Xamarin

TableView to display SwitchCell for each string on a list

ShehryarKhanShehryarKhan USMember

Hi, I cannot seem to figure this out. I need either a ListView or a TableView to display SwitchCells.
I have a list of strings for which i need to create a switchcell for.

var tags = Api.LoadFields();

here tags is a list of strings

i need to do something like this

            foreach (var label in tags)
            // create a new SwitchCell

adding a forloop in the code below becomes syntactically difficult to bug.

    tableView tableView = new TableView
  Intent = TableIntent.Form,
  Root = new TableRoot
    new TableSection
  //was trying to add foreach loop here
      new SwitchCell
        Text = "hello"
  //ending it here
Sign In or Register to comment.