Bug 33402 - WinRT: InputTransparent property of Label doesn’t work
Summary: WinRT: InputTransparent property of Label doesn’t work
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: unspecified
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-08-26 14:56 UTC by Catie Watson
Modified: 2016-04-13 18:48 UTC (History)
1 user (show)

Tags: ac
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:
Status:
RESOLVED FIXED

Description Catie Watson 2015-08-26 14:56:44 UTC
Even after setting InputTransparent to true for a Label, the label's gesture recognizer gets a response from a tap.

Attached demo code is the Xamarin.Forms WorkingWithGestures sample code. I added a WinRT project. In TapInsideImage.cs in the WorkingWithGestures platform-independent project, I added a gesture recognizer to the Label and set InputTransparent to true. The demo shows that if you tap on the label, you will still get a response from gestureRecognizer that changes the text to “wrong place to tap”.

This works correctly on Android.

 <package id="Xamarin.Forms" version="1.4.3.6372" targetFramework="win81"
Comment 1 Catie Watson 2015-08-26 15:03:43 UTC
Was unable to upload entire sample solution due to size limitations. Here is the code from TapInsideImage.cs:

using System;
using Xamarin.Forms;
using System.Diagnostics;

namespace WorkingWithGestures
{
	public class TapInsideImage : ContentPage
	{
		int tapCount;
        StackLayout text;
		readonly Label label;
        Entry editText;

		public TapInsideImage()
		{
			var image = new Image
			{
				Source = "tapped.jpg",

				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.CenterAndExpand,
			};


			var tapGestureRecognizer = new TapGestureRecognizer();
//			tapGestureRecognizer.NumberOfTapsRequired = 2; // double-tap
			tapGestureRecognizer.Tapped += OnTapGestureRecognizerTapped;
			image.GestureRecognizers.Add(tapGestureRecognizer);

            text = new StackLayout { Orientation = StackOrientation.Vertical };
            

			label = new Label
			{
				Text = "tap the photo!",
				FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.CenterAndExpand,
                InputTransparent = true
			};
            label.GestureRecognizers.Add(tapGestureRecognizer);
            text.Children.Add(label);

			Content = new StackLayout
			{
				Padding = new Thickness(20, 100),

				Children =
				{
					image,
					text
				}
			};
		}

		void OnTapGestureRecognizerTapped(object sender, EventArgs args)
		{
            if (sender is Label)
            {
                label.Text = "Wrong Place to Tap";
            }
            else{
            
			tapCount++;
			label.Text = String.Format("{0} tap{1} so far!",
				tapCount,
				tapCount == 1 ? "" : "s");
			var imageSender = (Image)sender;

			// watch the monkey go from color to black&white!
			if (tapCount % 2 == 0) {
				imageSender.Source = "tapped.jpg";
			} else {
				imageSender.Source = "tapped_bw.jpg";
			}

            if (tapCount % 2 == 0)
            {
                editText = new Entry();
                text.Children.Add(editText);
                editText.Keyboard = Keyboard.Numeric;
                editText.Focus();
            }
            else
            {
                if(editText != null && text.Children.Contains(editText))
                    text.Children.Remove(editText);
            }
			Debug.WriteLine ("image tapped: " + ((FileImageSource)imageSender.Source).File);}
		}
	}
}
Comment 2 Paul DiPietro [MSFT] 2015-09-01 16:24:51 UTC
Occurring up through the latest 1.5.0.6404-pre3 release of Forms.
Comment 3 Paul DiPietro [MSFT] 2016-04-13 18:48:20 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.


For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team