Bug 21952 - On WinPhone, binding via XAML to Switch.IsEnabled works upon page load but no effect afterwards
Summary: On WinPhone, binding via XAML to Switch.IsEnabled works upon page load but no...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-08-08 12:02 UTC by andrew.bilyk
Modified: 2014-09-22 13:30 UTC (History)
4 users (show)

Tags:
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 andrew.bilyk 2014-08-08 12:02:51 UTC
I'm using XAML to define a ContentPage, which contains a ScrollView which contains a Grid.  I have multiple switches within the grid, defined like so:

<Switch IsToggled="{Binding IsTransportationCategoryEnabled, Mode=TwoWay}"
              IsEnabled="{Binding IsTransportationCategorySettingEditable}"
              Grid.Row="7"
              Grid.Column="1" />

On Windows Phone, the IsEnabled binding takes effect only upon load of the page; the switch's enabled-ness will reflect the status of that bool upon initial page load, but further changes to that bool during the page's life have no effect.  I can confirm that I'm using NotifyPropertyChanged correctly.

This problem does not occur on Android; unable to check at the moment on iOS.

Also, as a test on Windows Phone again, I temporarily changed the offending IsEnabled attributes to IsVisible (leaving everything else the same), and that worked correctly, with each switch visibly disappearing when appropriate.
Comment 1 Seth Rosetter 2014-09-03 18:07:37 UTC
I have confirmed this issue. Thank you for filing.
Comment 2 Eric Maupin 2014-09-22 13:30:57 UTC
Fixed in 1.2.3-pre3.