Bug 42506 - Button TextColor using Styles and Triggers with IsEnable=False
Summary: Button TextColor using Styles and Triggers with IsEnable=False
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.2
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-07-13 09:48 UTC by apadol@ikomobi.com
Modified: 2017-06-28 14:03 UTC (History)
5 users (show)

Tags: ac styles trigger
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 42506 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description apadol@ikomobi.com 2016-07-13 09:48:47 UTC
Hey everybody,

I'm using global styles in App.xaml to define a standard button style, as follows:

 <Style x:Key="mainButton" TargetType="Button">
                <Setter Property="Font" Value="Bold, 17" />
                <Setter Property="HeightRequest" Value="{StaticResource MainButtonHeight}" />
                    <Trigger TargetType="Button" Property="IsEnabled" Value="True">
                        <Setter Property="TextColor" Value="{StaticResource White}" />
                        <Setter Property="BackgroundColor" Value="{StaticResource MainOrange}" />
                    <Trigger TargetType="Button" Property="IsEnabled" Value="False">
                        <Setter Property="TextColor" Value="{StaticResource White}" />
                        <Setter Property="BackgroundColor" Value="{StaticResource LightGray}" />

When my button has IsEnabled="True" the style works, meaning by button's background is orange, and my text color is white.

But when my button goes to IsEnabled="False", the background color changes to LightGray (OK), but the TextColor goes to Black instead of the value in my Style, which is White.

So it seems the TextColor cannot be changed using a trigger on IsEnabled="False"

This behavior happens on both iOS and Android.
Comment 1 Rui Marinho 2016-08-12 11:33:42 UTC
I think i know why this is happening , when a button is disable i think theres different properties to set for affecting the foreground color in each platform. We have to override the default disable style. 

Thanks for reporting
Comment 2 Robert McLaws 2017-02-21 15:01:09 UTC
Any word on whether or not this will get updated for the Cycle 9 release?