Bug 31964 - [Xamarin.Forms SwitchCell]OnChange() did not work for Windows platform
Summary: [Xamarin.Forms SwitchCell]OnChange() did not work for Windows platform
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: E.Z. Hart [MSFT]
URL:
: 31837 ()
Depends on:
Blocks:
 
Reported: 2015-07-15 05:11 UTC by Xinheng SHENG
Modified: 2016-04-13 04:45 UTC (History)
10 users (show)

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


Attachments
A piece of code (134.13 KB, image/png)
2015-07-15 05:12 UTC, Xinheng SHENG
Details
Sample Project (270.18 KB, application/zip)
2015-08-07 11:09 UTC, Ram Chandra
Details
Project to reproduce the bug (58 bytes, text/plain)
2015-08-12 17:32 UTC, E.Z. Hart
Details


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 Xinheng SHENG 2015-07-15 05:11:28 UTC
I think I encountered a bug. I used a default SwitchCell in a TableView. I needed to listen to the change of the toggle so I applied the function OnChanged.

When I deployed this app to iOS and Android, it worked very well. But for windows phone 8.1, it looked like the program didn't execute this function (but no errors). Whatever I output in this function, it never showed up in my console.

Some nice friends in forum tested for me. It seems this bug only shows up in Windows 8.1 and WindowsPhone 8.1. Here is a part of my code. I hope you guys could test it and if it is true, it will be fixed in the next release. Thank you.
Comment 1 Xinheng SHENG 2015-07-15 05:12:32 UTC
Created attachment 12033 [details]
A piece of code
Comment 2 Ram Chandra 2015-08-07 11:09:42 UTC
Created attachment 12411 [details]
Sample Project

I have checked this issue but I am unable to reproduce this issue.

Steps I followed:

1. Open the attached sample.
2. Restore the Xamarin.Forms nuget package.
3. Build and deploy the project in windows 8.1 emulator

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

Observation: I observed that the OnChanged event of switch cell works on all three environment, i.e. android,iOS and windows 8.1.

Could you please provide the version of Xamarin.Forms you are using and environment information? So that we can reproduce this issue at our end.

You can get environment information from here:
Visual Studio => HELP => About Microsoft Visual Studio => Copy Info

Also, please have a look on attached screen cast and let me know if I am missing anything?

Environment Info:

Xamarin.Forms.1.3.3.6323
Xamarin.Forms.1.5.0.6396-pre1

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0447006-02641
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-004-0447006-02641
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0447006-02641
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0447006-02641
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0447006-02641
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0447006-02641
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0447006-02641
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-0447006-02641
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.3.50717.0
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 Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft 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.2.20703.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.2
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

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

Microsoft Azure Mobile Services Tools   1.2
Microsoft Azure Mobile Services Tools

Multilingual App Toolkit   3.1.1250.0
Multilingual App Toolkit helps you localize your Windows Store app by providing file management, pseudo and machine translation, translation editor, and build integration. http://go.microsoft.com/fwlink?linkid=245767

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

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.2
Provides file classification services using PowerShell

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 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.11.666.0 (ebae43a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.4.16 (5f55a9ef61c11b6ce0890bc91e4c71b1b92be214)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS   8.10.2.0 (67b390d0d1bd741582cf7b7fd3ffea08583a3f83)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration
Comment 3 E.Z. Hart 2015-08-12 17:32:50 UTC
Created attachment 12479 [details]
Project to reproduce the bug

I created a simple project to reproduce this bug. The main form contains a list view with switch cells and a label bound to the count of switch cells set to the 'On' position. 

The application works as expected on iOS (switching cells on and off changes the count in the label) but does not work on Windows Phone 8.1.

I've tested this in the iPhone 4s emulator and the Windows Phone 8.1 emulator; I've not tested it on physical devices.
Comment 4 E.Z. Hart 2015-08-12 17:35:50 UTC
I believe this bug is related to https://bugzilla.xamarin.com/show_bug.cgi?id=31837
Comment 5 Ram Chandra 2015-08-17 11:22:01 UTC
@E.Z. Hart: Thanks for the sample project.

I have checked this issue and with the help of attached project I am able to reproduce this issue.
I am not getting this issue with iOS project. The OnChange event is working fine with iOS project but not working with windows phone.

Screencast: http://www.screencast.com/t/nWpqdnqiLIu
Output logs: https://gist.github.com/Parmendrak/15b6a1c0a06eabcaea35
IDE logs: https://gist.github.com/Parmendrak/503c22ef4f963f33491d

Environment Info: 

Xamarin.Forms 1.4.4.6392
Xamarin.Forms 1.5.0.6396-pre1

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0447006-02641
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-004-0447006-02641
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0447006-02641
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0447006-02641
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0447006-02641
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0447006-02641
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0447006-02641
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-0447006-02641
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.3.50717.0
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 Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft 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.2.20703.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.2
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

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

Microsoft Azure Mobile Services Tools   1.2
Microsoft Azure Mobile Services Tools

Multilingual App Toolkit   3.1.1250.0
Multilingual App Toolkit helps you localize your Windows Store app by providing file management, pseudo and machine translation, translation editor, and build integration. http://go.microsoft.com/fwlink?linkid=245767

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

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.2
Provides file classification services using PowerShell

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 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.11.666.0 (ebae43a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.4.16 (5f55a9ef61c11b6ce0890bc91e4c71b1b92be214)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS   8.10.2.0 (67b390d0d1bd741582cf7b7fd3ffea08583a3f83)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration
Comment 6 Ram Chandra 2015-08-17 11:25:20 UTC
*** Bug 31837 has been marked as a duplicate of this bug. ***
Comment 7 Xinheng SHENG 2015-08-18 10:52:51 UTC
Thanks for all your tests. But as described, I still have this issue. I attach my system info if it would help. I'm using win 10 preview.

Microsoft Visual Studio Community 2015 RC
Version 14.0.22823.1 D14REL
Microsoft .NET Framework
Version 4.5.53349

Installed Version: Community

Visual Basic 2015 RC   00269-30000-00001-AA240
Microsoft Visual Basic 2015 RC

Visual C# 2015 RC   00269-30000-00001-AA240
Microsoft Visual C# 2015 RC

Visual C++ 2015 RC   00269-30000-00001-AA240
Microsoft Visual C++ 2015 RC

Visual F# 2015 RC   00269-30000-00001-AA240
Microsoft Visual F# 2015 RC

Windows Phone SDK 8.0 - ENU   00269-30000-00001-AA240
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools RC   14.0.20417.0
ASP.NET and Web Tools RC

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

Common Azure Tools   1.4
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GenerateUnitTest   1.0
Generates unit test code for methods in classes under test.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

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

SQL Server Data Tools   14.0.50325.0
Microsoft SQL Server Data Tools

Xamarin   3.11.666.0 (ebae43a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.4.16 (5f55a9ef61c11b6ce0890bc91e4c71b1b92be214)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.10.2.0 (67b390d0d1bd741582cf7b7fd3ffea08583a3f83)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration
Comment 8 Shane 2016-02-11 07:46:57 UTC
Having this issue with "2.1.0.6513-pre4" on Windows Phone 8.1 and Universal Windows
Comment 9 E.Z. Hart [MSFT] 2016-02-19 23:47:52 UTC
Still happening in 2.1
Comment 10 Jason Smith [MSFT] 2016-04-11 07:09:35 UTC
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue, we would very much appreciate it. 


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

Warm regards,
Xamarin Forms Team
Comment 11 Jason Smith [MSFT] 2016-04-11 07:09:53 UTC
In particular I believe this is fixed in 2.2.0-pre1
Comment 12 Shane 2016-04-13 04:45:49 UTC
Works for me now on UAP10
Tested with 2.2.0.5-pre2