This repository was archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
This repository was archived by the owner on May 1, 2024. It is now read-only.
GestureRecognizers does not work with button/ImageButton #4341
Copy link
Copy link
Closed as not planned
Description
Description
I'm unable to use GestureRecognizers on a button. Putting GestureRecognizers on StackLayout, ContentView etc is working fine.
Steps to Reproduce
- Declare some GestureRecognizers on button.
Expected Behavior
GestureRecognizers like Tapped and Swiped should work as expected.
Actual Behavior
None of those GestureRecognizers gets called
Basic Information
- Version with issue:
- Last known good version: ?
- IDE: VS 15.8.5
- Platform Target Frameworks:
- Android: 8.1
- Nuget Packages: XF 3.3.0.967583
- Affected Devices: I'm using Genymotion emulator with android 8
Screenshots
N/A
Reproduction Link
https://github.com/ysmoradi/XFButtonGestureRecognizersIssue/blob/master/src/App/App.xaml
<?xml version="1.0" encoding="utf-8" ?>
<Application
x:Class="XFButtonGestureRecognizersIssue.App"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<Application.MainPage>
<ContentPage x:Name="Page">
<StackLayout CompressedLayout.IsHeadless="True">
<Button Text="Test 1">
<View.GestureRecognizers>
<ClickGestureRecognizer Clicked="TapGestureRecognizer_Tapped" />
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
</View.GestureRecognizers>
</Button>
<Label Text="Test 2">
<View.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
</View.GestureRecognizers>
</Label>
</StackLayout>
</ContentPage>
</Application.MainPage>
</Application>
public partial class App : Application
{
public App()
{
InitializeComponent();
}
void TapGestureRecognizer_Tapped(object sender, EventArgs e)
{
((VisualElement)sender).BackgroundColor = Color.LightBlue;
}
}
joseluisct