I have a ListView with Label and Checkbox
I want to implement a button lister that will get all checked items from my ListView
This is the ListView
<ListView ItemsSource="{Binding OCParticipantsTable}"
HasUnevenRows="True"
x:Name="dsfdf">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Label Text="{Binding FirstName_}"/>
<CheckBox/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
This is the ItemsSource property:
private ObservableCollection<ParticipantsTable> _OCParticipantsTable =
new ObservableCollection<ParticipantsTable>();
public ObservableCollection<ParticipantsTable> OCParticipantsTable
{
get { return _OCParticipantsTable; }
set
{
if (_OCParticipantsTable != value)
{
_OCParticipantsTable = value;
OnPropertyChanged("ListOfItems");
}
}
}
How can I implement a button lister that will get all checked items from my ListView ?
Something like that:
foreach (var pt in dsfdf.ItemsSource)
{
if (pt.CheckBox.IsChecked)
{
// do something...
}
}
Aucun commentaire:
Enregistrer un commentaire