Bug 22327 - Windows Phone button Clicked event still fires when IsVisible=false
Summary: Windows Phone button Clicked event still fires when IsVisible=false
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 1.2.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-08-24 23:37 UTC by PaulH
Modified: 2015-01-22 10:05 UTC (History)
8 users (show)

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


Attachments
Sample project (294.23 KB, application/x-zip-compressed)
2014-08-24 23:48 UTC, PaulH
Details
Screenshot - tap at the top of the screen (20.90 KB, image/png)
2014-08-24 23:49 UTC, PaulH
Details

Description PaulH 2014-08-24 23:37:49 UTC
Steps to reproduce:
1. Add a button to a page, set IsVisible property to false
2. Build and run on a WP8.0 device or emulator
3. Tap the top of the screen as shown in the attached screenshot

Actual results:
Button event fires as if the button is visible, even though it is not shown on screen. Click gesture does not reach any elements under the invisible one (eg. the list item in the sample)

Expected results:
Buttons where IsVisible=false should be invisible, not be able to be clicked, and should not impede interaction with visible page elements (eg. First list item in the attached sample).

--

Tested against Android and Windows Phone 8.0, only seems to occur on Windows Phone.  See attached project for a sample, and see attached screenshot to illustrate where to click to fire the invisible button event.

Environment details:
Microsoft Visual Studio Professional 2013
Version 12.0.30501.00 Update 2
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0444002-02230
Microsoft LightSwitch for Visual Studio 2013

Office Developer Tools - May 2014 Update ENU   06177-004-0444002-02230
Microsoft Office Developer Tools for Visual Studio 2013 - May 2014 Update ENU

Team Explorer for Visual Studio 2013   06177-004-0444002-02230
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0444002-02230
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0444002-02230
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0444002-02230
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0444002-02230
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0444002-02230
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06177-004-0444002-02230
Windows Phone SDK 8.0 - ENU

ASP.NET and Web Tools   2013.2.50425
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Windows Azure Web Sites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Windows Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.1.20409.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.1
Provides common services for use by Azure Mobile Services and Windows Azure Tools.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

NuGet Package Manager   2.8.50313.46
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.30919.1
Microsoft SQL Server Data Tools

Windows Azure Mobile Services Tools   1.1
Windows Azure Mobile Services Tools

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.3.47.0 (0b2a123923812a88ed3091909478dbe9e0111f00)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android
Comment 1 PaulH 2014-08-24 23:48:38 UTC
Created attachment 7786 [details]
Sample project

Add Xamarin.Forms via Nuget and compile
Comment 2 PaulH 2014-08-24 23:49:44 UTC
Created attachment 7787 [details]
Screenshot - tap at the top of the screen

Run the attached project and tap at the top of the screen as shown in this screenshot
Comment 3 PaulH 2014-08-24 23:51:31 UTC
Sorry, should have also mentioned that I have tried this both in XAML and code, with the same effect.
Comment 4 Seth Rosetter 2014-09-02 13:23:11 UTC
I have confirmed this. Thank you for the concise reproduction!
Comment 5 rjcollingham 2014-10-07 12:26:09 UTC
I was just going to create a new bug when I spotted this one. It only occurs on Windows Phone.

Bizarre I know. I created an new XF shared project and replaced the App.cs GetMainPage() code with this code. Note that the btnMinus is set to IsVisible false yet when clicking the btnPlus it is actually btnMinus.Clicked code that is triggered.

My real scenario is that I want to show a Next button at the end of a game, but whilst this button is hidden the other buttons aren't working properly!!

Thanks
Russell

		public static Page GetMainPage()
		{
            int iCount = 0;
            Label clicks = new Label
            {
                Text = "0",
                Font = Font.SystemFontOfSize(50),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            Button btnPlus = new Button { Text = "Plus" };
            btnPlus.Clicked += ((s, e) =>
            {
                iCount++;
                clicks.Text = iCount.ToString();
            });
            Button btnMinus = new Button { Text = "Minus" };
            btnMinus.Clicked += ((s, e) =>
            {
                iCount--;
                clicks.Text = iCount.ToString();
            });
            btnMinus.IsVisible = false;
            return new ContentPage
			{
				Content = new StackLayout {
                    Orientation = StackOrientation.Vertical,
					VerticalOptions = LayoutOptions.CenterAndExpand,
					HorizontalOptions = LayoutOptions.CenterAndExpand,
                    Children = { clicks,
                                 new StackLayout
                                    {
                                        Orientation = StackOrientation.Horizontal,
					                    VerticalOptions = LayoutOptions.CenterAndExpand,
					                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                                        Children = { btnPlus, btnMinus},
                                    }
                    },
				},
			};
		}
Comment 6 Rui Marinho 2015-01-09 11:18:40 UTC
Thanks, it will be fixed in the next version 1.3.2
Comment 7 Ram Chandra 2015-01-22 10:05:34 UTC
I have checked this issue with following builds:

Xamarin.Forms.1.3.2.6299-pre1
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641
Installed Version: Professional
Xamarin   3.9.236.0 (d6a2cae)
Xamarin.Android   4.20.0.34 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Xamarin.iOS   8.6.0.0 (eb24bdcf5cba2c12b673a07e0a8cce368b9563b3)
Xamarin.iOS Unified Migration   1.0

I have checked the attached project and checked the code mentioned in Comment 5 and observed that now if we set the IsVisible property to false then the event is not fired for that control.

Screencast: http://www.screencast.com/t/qkbbfYwld

This issue has been fixed. Hence I am closing this issue.

Note You need to log in before you can comment on or make changes to this bug.