Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Disabled button color

$
0
0

I changed background color of a button and noticed that when button is disabled (IsEnabled=False) the button is not changed at all and looks same as enabled button. Then I decided to use triggers to set disabled background color as below:

<Style TargetType="Button">
    <Setter Property="BackgroundColor" Value="{StaticResource red}" />
    <Style.Triggers>
      <Trigger TargetType="Button" Property="IsEnabled" Value="True">
        <Setter Property="BackgroundColor" Value="{StaticResource red}" />
      </Trigger>
      <Trigger TargetType="Button" Property="IsEnabled" Value="False">
        <Setter Property="BackgroundColor" Value="{StaticResource grey}" />
      </Trigger>
    </Style.Triggers>
</Style>

Now enabled button looks good, disabled button looks good, but when button is disabled and then I change it to enabled, background color is changed to default one not to one that I defined.
What's is best way to customize disabled button style?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>