xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] AppThemeBinding No Longer Working on iOS #13028

Open stefanhk31 opened 3 years ago

stefanhk31 commented 3 years ago

Description

Updating from version 4.7.0.1351 to 4.8.0.1687 results in styles no longer responding to AppThemeBinding tags like they used to.

XAML:

    <Style TargetType="NavigationPage">
        <Setter Property="BackgroundColor" Value="{AppThemeBinding 
            Light={StaticResource BackgroundColor_Light}, 
            Dark={StaticResource BackgroundColor_Dark}}" />
    </Style>

Steps to Reproduce

  1. Update XF
  2. Set an element's background color based on AppThemeBinding in XAML
  3. Run the app on a simulator

Expected Behavior

Color adjusts when phone is in dark mode

Actual Behavior

Color no longer adjusts

Basic Information

Environment

=== Visual Studio Community 2019 for Mac ===

Version 8.8.3 (build 16)
Installation UUID: 6383feef-0c2d-4eca-a378-880900ba0e68
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

    Package version: 612000107

=== Mono Framework MDK ===

Runtime:
    Mono 6.12.0.107 (2020-02/a22ed3f094e) (64-bit)
    Package version: 612000107

=== Roslyn (Language Service) ===

3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.100/Sdks
SDK Versions:
    5.0.100
    5.0.100-rc.2.20479.15
    3.1.404
    3.1.403
    3.1.402
    3.1.401
    3.1.302
    3.1.301
    3.1.300
    3.1.200
    3.1.101
    3.1.100
    3.0.101
    3.0.100
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    5.0.0
    5.0.0-rc.2.20475.5
    3.1.10
    3.1.9
    3.1.8
    3.1.7
    3.1.6
    3.1.5
    3.1.4
    3.1.2
    3.1.1
    3.1.0
    3.0.1
    3.0.0
    2.1.23
    2.1.22
    2.1.21
    2.1.20
    2.1.19
    2.1.18
    2.1.17
    2.1.16
    2.1.15
    2.1.14
    2.1.13

=== .NET Core 3.1 SDK ===

SDK: 3.1.404

=== Xamarin.Profiler ===

Version: 1.6.15.68
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 12.2 (17535)
Build 12B45b

=== Xamarin.Mac ===

Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

=== Xamarin.iOS ===

Version: 14.6.0.15 (Visual Studio Community)
Hash: 87a1b18d8
Branch: d16-8
Build date: 2020-11-16 21:39:41-0500

=== Xamarin Designer ===

Version: 16.8.0.507
Hash: e87b24884
Branch: remotes/origin/d16-8
Build date: 2020-10-29 00:31:38 UTC

=== Xamarin.Android ===

Version: 11.1.0.17 (Visual Studio Community)
Commit: xamarin-android/d16-8/c0e2b8e
Android SDK: /Users/TuskSoftware/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        None installed

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.4
SDK Build Tools Version: 29.0.2

Build Information: 
Mono: be2226b
Java.Interop: xamarin/java.interop/d16-8@79d9533
ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
SQLite: xamarin/sqlite/3.32.1@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/TuskSoftware/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.8.0.32
Hash: 01a7774
Branch: remotes/origin/d16-8
Build date: 2020-10-13 23:32:30 UTC

=== Android Device Manager ===

Version: 16.8.0.45
Hash: fc0af5f
Branch: remotes/origin/d16-8
Build date: 2020-10-13 23:32:54 UTC

=== Build Information ===

Release ID: 808030016
Git revision: cc6375d2fdcc1b42532e551e24ce650eaca1ae45
Build date: 2020-11-25 13:16:20-05
Build branch: release-8.8
Xamarin extensions: cc6375d2fdcc1b42532e551e24ce650eaca1ae45

=== Operating System ===

Mac OS X 10.16.0
Darwin 20.1.0 Darwin Kernel Version 20.1.0
    Sat Oct 31 00:07:11 PDT 2020
    root:xnu-7195.50.7~2/RELEASE_X86_64 x86_64

Screenshots

Layout on 4.7 (correct): Simulator Screen Shot - iPhone 12 - 2020-12-02 at 15 25 32

Layout on 4.8 (incorrect, no code change, phone simulator still in Dark Mode): Simulator Screen Shot - iPhone 12 - 2020-12-02 at 15 16 51

thisismyself commented 3 years ago

What is the reason for this issue? Is it known? It still works in my setup, as OP described for Simulator. For real device I cannot tell.

App overview:

Xamarin.Forms 4.8.0.1687 Xamarin.Forms.Visual.Material 4.8.0.1687

Visual Studio 16.7.7 Xamarin.iOS 14.2.0.12 XCode 12.1