Bug 55474 - Custom stack layout ignores gesture recogniser
Summary: Custom stack layout ignores gesture recogniser
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.4
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
Depends on:
Reported: 2017-04-21 18:22 UTC by Paul Johnson
Modified: 2017-06-05 18:04 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Paul Johnson 2017-04-21 18:22:39 UTC
I have a simple custom renderer on a stack layout to give it a background colour and curved corners (a frame is no good for what I'm doing).

I have a TapGesture defined for the stack layout to fire off a command. On iOS, it works without an issue. On Android, the gesture recogniser is ignored (breakpoint inside never hits)

Cuatom Renderer
public class CustomStackLayoutRenderer : VisualElementRenderer<StackLayout>
        protected override void OnElementChanged(ElementChangedEventArgs<StackLayout> e)

var loginFrame = new CustomStackLayout
                BackgroundColor = LookAndFeel.ButtonBgColor,
                WidthRequest = App.ScreenSize.Width * .8,
                HeightRequest = 38,
                Children =
                    new StackLayout
                        Orientation = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Padding = new Thickness(8, 4),
                        Children =
                            new Image
                                Source = "login",
                                WidthRequest = 32,
                                HeightRequest = 32,
                            new Label
                                Text = ViewModel.LoggedIn? Langs.Login_LoginButtonDone : Langs.Login_LoginButton,
                                FontFamily = LookAndFeel.Futura_Book,
                                FontSize = 16,
                                TextColor = LookAndFeel.ButtonTextColor,
                                VerticalTextAlignment = TextAlignment.Center
            loginFrame.SetBinding(Button.IsEnabledProperty, new Binding("LoginOK", converter: new BoolToString()));
            var loginFrameTap = new TapGestureRecognizer
                NumberOfTapsRequired = 1,
                Command = new Command(() => ViewModel.LoginCommand.Execute((null))),

The CustomStackLayout is an empty class that inherits StackLayout.

Xam Forms :

=== Xamarin Studio Community ===

Version 6.3 (build 863)
Installation UUID: f3d1a29c-1ba2-4a83-a193-1087efe91a85
	Mono (2017-02/4242008) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500000061

=== NuGet ===


=== Xamarin.Profiler ===

Version: 1.5.3
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.1 (12170)
Build 8E2002

=== Xamarin.iOS ===

Version: (Xamarin Studio Community)
Hash: 1fe8f10c
Branch: d15-2
Build date: 2017-04-13 22:19:00-0400

=== Xamarin.Android ===

Version: (Xamarin Studio Community)
Android SDK: /Users/PFJ/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)
		7.0   (API level 24)
		7.1   (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.4
SDK Build Tools Version: 25.0.2

Java SDK: /usr
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Android Designer EPL code available here:

=== Xamarin.Mac ===

Version: (Xamarin Studio Community)

=== Xamarin Inspector ===

Version: 1.2.1
Hash: 0ea0a12
Branch: d15-1
Build date: Thu, 06 Apr 2017 20:24:44 GMT

=== Build Information ===

Release ID: 603000863
Git revision: a2163670efe259c85cd8f335d95b175068fbbe2a
Build date: 2017-04-03 14:33:15-04
Xamarin addins: 2045d688ea1420e0381b473360ca62a763eb7d04
Build lane: monodevelop-lion-d15-1

=== Operating System ===

Mac OS X 10.12.4
Darwin iMac.local 16.5.0 Darwin Kernel Version 16.5.0
    Fri Mar  3 16:52:33 PST 2017
    root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
Comment 1 Jimmy [MSFT] 2017-04-21 23:28:47 UTC
I wasn't able to reproduce this issue with a sample project I created based on the code provided. I tested on an Android 6.0 device with Form and the TapGestureRecognizer worked as expected.

What Android version and device/emulator are you testing with? Can you confirm that the issue does not happen when using a StackLayout instead a custom one?
Comment 2 Jimmy [MSFT] 2017-06-05 18:04:42 UTC
Because we have not received a reply to our request for more information in over 4 weeks, we are closing this issue. However, this _might_ be fixed in 2.3.5 pre-releases due to this pull request: https://github.com/xamarin/Xamarin.Forms/pull/842 

If you continue encountering this issue with version 2.3.5 or higher, please reopen the ticket with the requested information so we can continue looking into this. Thanks!