Hello,
Welcome to Microsoft Q&A!
But if I do that for set, in the listview only the last one is selected:
It's by default, the SelectedItem was used to get or set SelectedItem. it is single item but not collection . if you want to Set multiple selected item in ListView from code behind. You could call UsersListView.SelectedItems.Add
method to add the selected item.
foreach (User userSelected in Users)
{
UsersListView.SelectedItems.Add(userSelected);
}
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
The problem is you add selected item in MainPage ctor mothed. but the listview has not loaded. It will work if you place add method in the listview Loaded event.