Tableview Xamarin 表单

Tableview Xamarin forms

使用 Tableview 帮助实施。 C#下通过循环填充tableview的switch cells。 我无法对那些包含开关盒的单元格进行 selection。

<TableView   x:Name="tableView1" 
                         Intent="Data" 
                         VerticalOptions="FillAndExpand">
                <TableRoot>
                    <TableSection x:Name="LabSelection1" 
                                  Title="select needed detail"/>
                </TableRoot>
            </TableView>

C#:

LabSelection1.Clear();
            for(int i=0; i<15; i++)
            {
                SwitchCell cell = new SwitchCell();
                cell.Text = "DEV"+i;
                cell.On = false;
                LabSelection1.Add(cell);
            }

通过 selectlistbox 中的 foreach select 在 winforms 中。 tableview上有没有这种东西,怎么实现的?

已解决。

foreach (SwitchCell cell in LabSelection1)
{
  if(cell.On == true) { DisplayAlert("" + cell, "YES "+cell.Text, "OK"); }
  else DisplayAlert("" + cell, "NO", "OK");
}