Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] UWP switch has inconsistent visual state with IsEnabled binding #15810

Open
vdheuvel opened this issue Aug 28, 2023 · 1 comment
Open
Labels
a/switch p/UWP s/unverified New report that has yet to be verified t/bug 🐛

Comments

@vdheuvel
Copy link

vdheuvel commented Aug 28, 2023

Description

Switches look inconsistent (color, hover) when using different IsEnabled initial values. Only observed on UWP.

Steps to Reproduce

  1. Put toggles in your view like this, where the IsEnabled uses a binding for one switch, but not for another:
        <Switch IsToggled="{Binding Switch1IsToggled}" /> // toggle 1
        <Switch IsEnabled="{Binding Switch1IsToggled}" /> // toggle 2
        <Switch IsEnabled="True" /> // toggle 3
        <Switch IsEnabled="{Binding Switch1IsToggled}" OnColor="Black" /> // toggle 4
  1. Flip the toggle 1

Expected Behavior

Toggles 2 and 3 look and behave the same under hover / no hover. Personally I prefer the look of toggle 3, because toggle 2 looks like it's disabled when it isn't.

Actual Behavior

The visual states for toggle 2 and 3 are different: 2 looks disabled and grey, but becomes blue when hovering. 3 looks enabled and blue, and becomes slightly lighter when hovering.

Basic Information

  • Version with issue: Xamarin.Forms 5.0.0.2612
  • Last known good version: did not check
  • Platform Target Frameworks:
    • UWP: 16299 (win 10)

Environment

Show/Hide Visual Studio info
Microsoft Visual Studio Professional 2022 (4)
Version 17.7.0
VisualStudio.17.Release/17.7.0+34003.232
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Professional

Visual C++ 2022   00476-80000-00000-AA587
Microsoft Visual C++ 2022

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools   17.7.265.7160
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.7.265.7160
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio   2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   17.7.265.7160
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   4.7.0-3.23373.1+7829f6b85177e96de89bc67f32b61d74ac590f5a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

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

Extensibility Message Bus   1.4.34 (main@d5ab18b)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

GitHub Copilot   1.100.0.0 (v1.100.0.0@6ff082509)
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

GitHub Copilot Agent   1.100.306 (v1.100.0)

Microsoft Azure Hive Query Language Service   2.6.5000.0
Language service for Hive query

Microsoft Azure Stream Analytics Language Service   2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.7.27 (547ea6f)
Support for debugging Mono processes with Visual Studio.

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

Razor (ASP.NET Core)   17.7.3.2333001+0ab18affdf2a37647768d0e25f5f021bee6257a1
Provides languages services for ASP.NET Core Razor.

ResX Resource Manager   ResXManager
Manage localization of all ResX-based resources in one place. Shows all resources of a solution and lets you edit the strings and their localizations in a well-arranged data grid.

SQL Server Data Tools   17.7.9.2
Microsoft SQL Server Data Tools

StylerPackage Extension   1.0
StylerPackage Visual Stuido Extension Detailed Info

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   17.0.20628.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.7.0-3.23373.1+7829f6b85177e96de89bc67f32b61d74ac590f5a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.7.0-beta.23314.10+e612cf93b989503c89e3a5830090062b7ab5e143
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   17.7.0.214 (d17-7@a69bacb)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.7.3.9 (remotes/origin/d17-7@796d191def)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   17.7.21 (150ec9f)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   13.2.1.2 (d17-5/a8a26c7)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: d9a6e87
    Java.Interop: xamarin/java.interop/d17-5@149d70fe
    SQLite: xamarin/sqlite/3.40.1@68c69d8
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d


Xamarin.iOS and Xamarin.Mac SDK   16.4.0.5 (191fe02ea)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Screenshots

Screenshot, when not hovering, notice the difference between toggles 2 and 3:
image

Reproduction Link

XamarinSwitchUWPBug.zip

Workaround

Workaround: set OnColor, like in toggle 4. This will make the switches look consistent, but it does remove the hover highlight.

@vdheuvel vdheuvel added s/unverified New report that has yet to be verified t/bug 🐛 labels Aug 28, 2023
@MitchBomcanhao
Copy link

I tried this on my own project, couldn't reproduce the issue. I didn't use your project, but I did make a very similar one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/switch p/UWP s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

3 participants