Hello,
Welcome to our Microsoft Q&A platform!
SelectedItem in collection view is not triggering when I add GestureRecognizers in COntentview.
Yes, it is just the case as you said.
There is a tap recognizer conflict between the TapGestureRecognizer
of the outer ContentView
and the inner CollectionView
.
Android has the same problem, but in a different way.
If we add function closePopup
for the Tapped
event of the TapGestureRecognizer as follows:
<ContentView x:Name="languagePopup" BackgroundColor="Yellow" >
<ContentView.GestureRecognizers>
<TapGestureRecognizer Tapped="closePopup"></TapGestureRecognizer>
</ContentView.GestureRecognizers>
<!--other code-->
</ContentView >
function closePopup
in xaml.cs:
private void closePopup(object sender, System.EventArgs e)
{
DisplayAlert("Alert", "You have been alerted", "OK");
}
In android, we couldn't pop up the DisplayAlert in function closePopup
, but SelectedItem
in collection view is triggering normally.
In Ios, we could pop up the DisplayAlert in function closePopup
,but SelectedItem
in collection view isn't triggering normally.
That's based on the difference of different platform(android,ios ).
As a summary, when two controls are nested, we should never use the tap recognition of two controls together.
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.