Description
On android when a view is rendered and a new GestureRecognizer is added to its GestureRecognizers by behind code, the Tapped events fire multiple times.
Steps to Reproduce
-
Create a new MAUI App
-
Replace content of MainPage.xaml with
<VerticalStackLayout>
<Button x:Name="tapButton" Text="Tap button">
<Button.GestureRecognizers>
<TapGestureRecognizer Tapped="OnTapped" />
</Button.GestureRecognizers>
</Button>
<Button Text="Add new Gesture" x:Name="addGestureButton" />
</VerticalStackLayout>
- Replace MainPage.xaml.cs with following:
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
addGestureButton.Clicked += (s, e) =>
{
var p = new TapGestureRecognizer();
p.Tapped += (s, e) =>
{
};
tapButton.GestureRecognizers.Add(p);
};
}
public void OnTapped(object sender, TappedEventArgs args)
{
// runs multiple times by one tap
}
}
- Start debugging on Android
- tap on "Add new Gesture"
- tap on "Tap button"
Link to public reproduction project repository
No response
Version with bug
8.0.10 SR3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
Description
On android when a view is rendered and a new GestureRecognizer is added to its GestureRecognizers by behind code, the Tapped events fire multiple times.
Steps to Reproduce
Create a new MAUI App
Replace content of MainPage.xaml with
Link to public reproduction project repository
No response
Version with bug
8.0.10 SR3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response