How can I select a CheckBox
inside a ListView
via code?
I found some code online to check the boxes but checked property is not available in windows phone 8.1
foreach (ListViewGroup grp in listFiles.Groups)
{
foreach (ListViewItem item in grp.Items)
{
if (item.Index != 0)
{
item.Checked = true;
}
}
}
the xaml code is
<ListView x:Name="ContentListView" SelectionMode="Multiple">
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Foreground="Black" Text="{Binding}" FontSize="25"></TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
The checkboxes are automatically generated checkboxes of listview
You should add item which you want to be checked to the ListView's SelectedItems
list
foreach(var item in MyListView.Items)
{
MyListView.SelectedItems.Add(item);
}