I want to get data from the SelectedItem in CollectionView, but doing that I must work with SelectionChanged_EventHandler(object sender, SelectionChangedEventArgs e) which appear to be inside the Back-end code of the Content Page. I want to process this work inside my ViewModel code instead as I have to pass the data from SelectedItem to my ObservableCollection<> in the ViewModel code.
Is there any method that I can get data from the SelectedItem in CollectionView and also handle this event inside my ViewModel code?
Yes! There are several ways to do this:
1) Using SelectedItem Bindeable property to trigger the event
XAML:
ViewModel:
2) Using a TapGestureRecognizer: this will trigger On Tapping, is different that selection but achieves the same
Xaml:
Viewmodel: You will have to create the command and the method