xamarin / Xamarin.Forms

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

[Bug] FontImageSource ignores Color property in ToolbarItem #10898

Open dwhiteddsoft opened 4 years ago

dwhiteddsoft commented 4 years ago

Description

When you have a FontImageSource in a ToolbarItem with the color set that differs from the color set in style Shell.ForegroundColor it is ignored.

Steps to Reproduce

  1. Have a style set like so:
    <Setter Property="Shell.ForegroundColor" Value="White" />
  2. Have a ToolBarItem set like so:
    <ContentPage.ToolbarItems> <ToolbarItem Clicked="AddItem_Clicked"> <ToolbarItem.IconImageSource> <FontImageSource FontFamily="{DynamicResource MaterialFontFamily}" Glyph="&#xf0112;" Color="DeepPink" /> </ToolbarItem.IconImageSource> </ToolbarItem> </ContentPage.ToolbarItems>

Expected Behavior

I should see the flyout menu in white and the font icon in deep pink

Actual Behavior

Both the flyout menu and icon are white

Basic Information

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

Version 8.6.1 (build 26) Installation UUID: fdf5b6f7-b96b-4526-9f47-071e53816fea GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

Package version: 610000104

=== Mono Framework MDK ===

Runtime: Mono 6.10.0.104 (2019-12/5d03a6fe116) (64-bit) Package version: 610000104

=== Roslyn (Language Service) ===

3.6.0-3.20210.9+4eafdcb1bcbd8d3573f2ba6065e56d9b9ce4f8a3

=== NuGet ===

Version: 5.6.0.6591

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.300/Sdks SDK Versions: 3.1.300 3.1.200 3.1.102 3.1.101 3.0.101 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 3.1.4 3.1.2 3.1.1 3.0.1 2.1.18 2.1.16 2.1.15 2.1.14

=== Xamarin.Profiler ===

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

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 11.5 (16139) Build 11E608c

=== Xamarin.Mac ===

Version: 6.18.1.31 (Visual Studio Community) Hash: b3eedfed9 Branch: d16-6 Build date: 2020-04-09 10:22:36-0400

=== Xamarin.iOS ===

Version: 13.18.1.31 (Visual Studio Community) Hash: b3eedfed9 Branch: d16-6 Build date: 2020-04-09 10:22:36-0400

=== Xamarin Designer ===

Version: 16.6.0.329 Hash: d4f8bcd13 Branch: remotes/origin/d16-6 Build date: 2020-04-24 02:16:02 UTC

=== Xamarin.Android ===

Version: 10.3.1.0 (Visual Studio Community) Commit: xamarin-android/d16-6/3fe860a Android SDK: /Users/davidwhite/Library/Android/sdk Supported Android versions: 7.1 (API level 25) 8.1 (API level 27)

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

Build Information: Mono: 165f4b0 Java.Interop: xamarin/java.interop/d16-6@2cab35c ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.31.1@49232bc Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-6@bfb66f3

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/davidwhite/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.6.0.50 Hash: 5901879 Branch: remotes/origin/d16-6 Build date: 2020-04-30 04:01:22 UTC

=== Android Device Manager ===

Version: 16.6.0.95 Hash: 45d17b5 Branch: remotes/origin/d16-6 Build date: 2020-04-30 04:01:42 UTC

=== Build Information ===

Release ID: 806010026 Git revision: 9c7c371ce0eefcbfe3a406b6471abc91da319fdb Build date: 2020-05-25 07:00:13-04 Build branch: release-8.6 Xamarin extensions: 9c7c371ce0eefcbfe3a406b6471abc91da319fdb

=== Operating System ===

Mac OS X 10.15.5 Darwin 19.5.0 Darwin Kernel Version 19.5.0 Thu Apr 30 18:25:59 PDT 2020 root:xnu-6153.121.1~7/RELEASE_X86_64 x86_64

Screenshots

Screen Shot 2020-05-30 at 12 46 51 AM
Cfun1 commented 3 years ago

@rmarinho follow-up on https://github.com/xamarin/Xamarin.Forms/issues/4761#issuecomment-503773974, the issue reported here prevent dev from changing Icon tint for font icons also, was trying to use IconTintColorEffect.TintColor from xct but seems to have it own issues (https://github.com/xamarin/XamarinCommunityToolkit/issues/677) also, any updates on this ?

babak1199 commented 3 years ago

I'm facing the same problem. When I bind the Color property of FontImageSource to a ViewModel property, the color doesn't change but if I use the same 'FontImageSource' for a button on the same page, everything works as expected.

DidierVera commented 2 years ago

An alternative for it can be: Set the property Shell.ForegroundColor="Transparent"

Work fine for me.