Hi Phil,
Thank you for using Syncfusion support.
We have checked the reported query “SfListView tap item programmatically” from our end.
#Regarding the UI does not set the background color of the selected item
We would like to let you know that you can select an ListViewItem by the following ways,
- Setting SelectedItem property
private void Button_Clicked(object sender, EventArgs e)
{
var bc = (sender as Button).BindingContext as ContactsViewModel;
bc.SelectedItem = viewModel.contactsinfo[0];
} |
- Adding item to the SelectedItems collection
private void Button_Clicked(object sender, EventArgs e)
{
var bc = (sender as Button).BindingContext as ContactsViewModel;
listView.SelectedItems.Add(bc.contactsinfo[0]);
} |
In both cases, the UI will be updated as expected and the background color will be changed.
Please refer SfListView selection in our online documents from following link,
#Regarding the SelectionChanged event contains the item in the "AddedItems" list instead of the "RemovedItems" list
We would like to let you know that when selecting, the selected item is added in the AddedItems collection. While deselecting, the deselected item will be added in the RemovedItems collection.
ItemSelectionChangedEventArgs |
Description |
AddedItems |
Gets collection of the underlying data objects where the selection has been processed.
|
RemovedItems |
Gets collection of the underlying data objects where the selection has been processed.
|
Please refer SfListView selection in our online documents from following link,
#Regarding highlighting in the ui and the SfListView "knowing" which items are already added
You can achieve your requirement using the above solution to highlight the selection. Also, you can get the information of SelectedItem from AddedItems.
We have already documented this scenario in our online document. Please refer the following link,
We have attached the sample based on your requirement in the following link,
Please check the sample and let us know if you still facing the same issue? If not, please modify our sample to reproduce the issue and revert us back with the following details which would be helpful for us to check on it and provide you the solution at the earliest.
- Share issue reproducing video
- Share ListView related code snippet
- Share code snippet of programmatic tap
Lakshmi Natarajan