2

I've got a bunch of databound switches on one of my forms:

<Label Grid.Column="0" Grid.Row="0" Text="option 1" VerticalOptions="Center" FontSize="Large" HorizontalOptions="Start"/>
<Switch Grid.Column="1" Grid.Row="0" IsToggled="{Binding Options.One, Mode=TwoWay}" HorizontalOptions="End"/>
<Label Grid.Column="0" Grid.Row="1" Text="option 2" VerticalOptions="Center" FontSize="Large" HorizontalOptions="Start"/>
<Switch Grid.Column="1" Grid.Row="1" IsToggled="{Binding Options.Two, Mode=TwoWay}" HorizontalOptions="End"/>
<Label Grid.Column="0" Grid.Row="2" Text="option 3" VerticalOptions="Center" FontSize="Large" HorizontalOptions="Start"/>
<Switch Grid.Column="1" Grid.Row="2" IsToggled="{Binding Options.Three, Mode=TwoWay}" HorizontalOptions="End"/>
<Label Grid.Column="0" Grid.Row="3" Text="option 4" VerticalOptions="Center" FontSize="Large" HorizontalOptions="Start"/>
<Switch Grid.Column="1" Grid.Row="3" IsToggled="{Binding Options.Four, Mode=TwoWay}" HorizontalOptions="End"/>
<Label Grid.Column="0" Grid.Row="4" Text="option 5" VerticalOptions="Center" FontSize="Large" HorizontalOptions="Start"/>
<Switch Grid.Column="1" Grid.Row="4" IsToggled="{Binding Options.Five, Mode=TwoWay}"/>

Functionally, this is working as expected. However, I'm seeing a bit of an oddity with the UI...

If the binding source provides "true" at the point the page is displayed, the switch control looks as I'd expect - nice and bright, no matter how many times I toggle it.

However, if the binding source provides "false", and you then toggle the switch to "on", then it looks faded - almost as if it's disabled, even though its fully usable.

As I say, the functionality behind this works - my bound properties are getting updated correctly - it's just the visual appearance that's bugging me :)

In this picture, all the bound properties for odd-numbered options was set to "true", whereas the bound properties for the even-numbered ones were set "false". I've then toggled each option off and on a few times: enter image description here

Sk93
  • 3,676
  • 3
  • 37
  • 67
  • It has been answered here https://stackoverflow.com/q/46157966/11104068 – Saamer Jan 06 '20 at 14:05
  • @Saamer I'm not sure it has? That question refers to switches that are togged and disabled. In my case, they are not disabled, nor toggled. – Sk93 Jan 06 '20 at 14:09

1 Answers1

2

This was a bug introduced in XF 4.2.0. To resolve it, you'll need to downgrade to something lower than 4.2.0 or upgrade to Xamarin.Forms 4.4.0.991210-pre2 (4.4.0 Pre Release 2) or higher where the bug was fixed.

If possible, my recommendation would be to upgrade to XF 4.4.0 stable.

deczaloth
  • 7,094
  • 4
  • 24
  • 59
Andrew
  • 1,390
  • 10
  • 21
  • perfecto - much appreciated. Sad that my googlefoo failed to find that for me, but im glad it's not something stupid I was doing ^_^ – Sk93 Jan 07 '20 at 13:37