Forum Cross Platform with Xamarin

Iterate over a list to display SwitchCells

HI Im relatively new to Xamarin and c# :
so i have a list of strings
var tags = RoblyApi.LoadFields();
what i would like to do is, iterate over this list to form a SwitchCell on a TableView or ListView that will display each string on the list
What im trying to accomplish is: giving a user the ability to select which of the items on this list he would like on his forum.
TableView tableView = new TableView

this is the example Xamarin had for TableView. How would i loop through to form a new SwitchCell for each tag
Every time i did try to add an foreach loop I get many syntactical errors.

{
    Intent = TableIntent.Form,
 Root = new TableRoot
 {
        new TableSection
      {
      new SwitchCell
       {
          Text = "hello"
       }
    }
}

};
 this.Content = new StackLayout
{
    Children =
      {
    header,
    tableView
}
};

Thank You for your help :)

Posts

Sign In or Register to comment.