Hello,
Welcome to our Microsoft Q&A platform!
When you set the SelectedItem
for your CollectionView
, the data type of your SelectedItem
should be a data model
(Result
) not ICommand
(public ICommand SelectedItem { get; set; }
)
<CollectionView ItemsSource="{x:Binding pokeItems}"
SelectionMode="Single"
SelectedItem="{x:Binding SelectedItem}">
When we check the official document Xamarin.Forms CollectionView Selection,we will find
SelectedItem, of type
object
, the selected item in the list. This property has a default binding mode of TwoWay, and has a null value when no item is selected.
You can also refer to the sample code here: VerticalListSinglePreSelectionPage.xaml
Hope it can help you.
Best Regards,
Jessie Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
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.