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

[Bug] Brushes: NavigationBar.BarBackgroundColor assignment prevents NavigationBar.BarBackground brush rendering on Android #13491

Closed
Tommigun1980 opened this issue Jan 21, 2021 · 2 comments · Fixed by #13503
Assignees
Labels
a/brushes a/navbar e/3 🕒 3 in-progress This issue has an associated pull request that may resolve it! t/bug 🐛

Comments

@Tommigun1980
Copy link

Tommigun1980 commented Jan 21, 2021

Description

On iOS, when both a background color and a brush are defined on a NavigationBar, the brush will take precedence.
On Android, if a background color property is defined in any way on a NavigationBar, the brush will never be drawn.

So if your NavigationBar XAML looks like

BarBackgroundColor="Transparent"
BarBackground="{StaticResource SomeBrush}"

the BarBackground will not render on Android. Removing the 'BarBackgroundColor="Transparent"' property assignment makes the brush draw properly.

Not having a BarBackgroundColor assignment at all or setting it to Transparent should be equivalent (as a Color's default value is Transparent), yet the mere presence of said assignment makes brushes not draw on Android. This leads me to believe that a side-effect happens in the actual assignment on Android, which makes it draw incorrectly.

Use case is for example platform dependent colouring where one platform should use a color and another a brush.
The error seems to only happen with a NavigationBar, for example a ContentPage's background copes with this properly.

Edit: Clarified that issue only happens with a NavigationBar

Expected Behavior

BarBackgroundColor="Transparent" should have no effect on Android when a Brush is also defined.

Actual Behavior

The mere presence of a BarBackgroundColor assignment, even when used to set the value to the default Transparent, makes the brush not render on Android.

Basic Information

  • Version with issue: Xamarin.Forms 5.0.0-pre4.
  • Last known good version: None.
  • Platform Target Frameworks:
    • Android: Android 11.

Environment

Show/Hide Visual Studio info
Visual Studio Community 2019 for Mac (Preview)
Version 8.9 Preview (8.9 build 1451)
Installation UUID: 5200cbcd-8fce-4f04-9240-c3fc7ab0d676
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

	Package version: 612000113

Mono Framework MDK
Runtime:
	Mono 6.12.0.113 (2020-02/4fdfb5b1fd5) (64-bit)
	Package version: 612000113

Xamarin Designer
Version: 16.9.0.266
Hash: c4842c761
Branch: remotes/origin/c4842c761b9b6a95407f72278ca7fb42f8f7fdf0
Build date: 2021-01-07 06:17:08 UTC

Roslyn (Language Service)
3.9.0-3.20619.14+df59a33fd9beff9790e01a2a1ab21e4a1e6921b3

NuGet
Version: 5.8.0.6860

.NET Core SDK
SDK: /usr/local/share/dotnet/sdk/5.0.102/Sdks
SDK Versions:
	5.0.102
	5.0.101
	5.0.100
	3.1.405
	3.1.404
	3.1.403
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.2
	5.0.1
	5.0.0
	3.1.11
	3.1.10
	3.1.9

.NET Core 3.1 SDK
SDK: 3.1.405

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.9.0.27 (Visual Studio Community)
Hash: f4c9327fa
Branch: main
Build date: 2020-11-19 10:57:31-0500

Xamarin.Android
Version: 11.2.0.0 (Visual Studio Community)
Commit: xamarin-android/d16-9/f908d16
Android SDK: /Users/tommikiviniemi/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: 30.0.2

Build Information: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@1d382be
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.32.2@cfe06e0
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@ad80a42

Microsoft OpenJDK for Mobile
Java SDK: /Users/tommikiviniemi/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.9.0.21
Hash: 57e40ba
Branch: remotes/origin/main
Build date: 2021-01-08 01:57:14 UTC

Android Device Manager
Version: 16.9.0.14
Hash: 0fdccda
Branch: remotes/origin/main
Build date: 2021-01-08 01:57:36 UTC

Build Information
Release ID: 809001451
Git revision: cfd15313a6388ef8dada0182e22a058131c46f9d
Build date: 2021-01-15 08:42:21-05
Build branch: release-8.9
Xamarin extensions: cfd15313a6388ef8dada0182e22a058131c46f9d

Operating System
Mac OS X 10.16.0
Darwin 20.2.0 Darwin Kernel Version 20.2.0
    Wed Dec  2 20:39:59 PST 2020
    root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64
@Tommigun1980 Tommigun1980 added s/unverified New report that has yet to be verified t/bug 🐛 labels Jan 21, 2021
@jsuarezruiz jsuarezruiz removed the s/unverified New report that has yet to be verified label Jan 21, 2021
@Tommigun1980 Tommigun1980 changed the title [Bug] Brushes: Incompatibility on Android [Bug] Brushes: BackgroundColor assignment prevents Background brush rendering on Android Jan 21, 2021
@Tommigun1980 Tommigun1980 changed the title [Bug] Brushes: BackgroundColor assignment prevents Background brush rendering on Android [Bug] Brushes: NavigationBar.BarBackgroundColor assignment prevents NavigationBar.BarBackground brush rendering on Android Jan 21, 2021
@Tommigun1980
Copy link
Author

Edit: Amended bug report to specify this happens only with a NavigationBar, after confirming it's not a generic issue.

@jsuarezruiz jsuarezruiz added the in-progress This issue has an associated pull request that may resolve it! label Jan 22, 2021
@jsuarezruiz
Copy link
Contributor

@Tommigun1980 The issue will be fixed by #13503

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/brushes a/navbar e/3 🕒 3 in-progress This issue has an associated pull request that may resolve it! t/bug 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants