我有一个List<>
个项目,这些项目存储在ListView
CheckBox
&#39}中。我需要的是将检查的项目存储到另一个List<>
。以下是ListView
如何显示和填充数据的代码:
List<Product> _productsList = ProductsFromXml();
List<Product> checkedProducts = new List<Product>();
productsListView = FindViewById<ListView>(Resource.Id.listView1);
productsListView.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItemMultipleChoice, _productsList);
productsListView.ChoiceMode = ChoiceMode.Multiple;
答案 0 :(得分:-1)
确定。以下是c#代码:
foreach (ListViewItem xitem in productsListView.CheckedItems)
{
// Do whatever you want with checked item 'xitem'
}