Xamarin.forms: Disabled Button Appearance

Created on 27 Feb 2019  ·  1Comment  ·  Source: xamarin/Xamarin.Forms

Description

App.xaml

<Style x:Key="DefaultButtonStyle" TargetType="Button">
    <Setter Property="VerticalOptions" Value="Center" />
    <Setter Property="BackgroundColor" Value="Green" />
    <Setter Property="CornerRadius" Value="10" />
    <Setter Property="TextColor" Value="White" />
</Style>

View.xaml

<Button
    Style="{x:Static res:Styles.DefaultButtonStyle}"
    IsEnabled="false"
    Text="Sign" />

From the code above, it produces an undesirable look of a Button. The result would either be: text is not visible or the default IsEnabled appearance doesn't get applied. It still retain the other properties such as button click event is disabled.

This bug only occurs in Xamarin.iOS

Steps to Reproduce

  1. Copy-paste the code provided above into a working project.
  2. Debug it into an iPhone Simulator or an actual iPhone device.
  3. Navigate to the page where the button is located.
  4. Notice the appearance of the button.

Expected Behavior

The button should appear disabled while having a corner radius, green background and white text color.

Actual Behavior

Text is not visible or the default IsEnabled appearance doesn't get applied

Basic Information

  • Version with issue: 3.5.0.129452
  • Last known good version: NA
  • IDE: Visual Studio for Mac
  • Platform Target Frameworks:

    • iOS: 8.0

    • Android: NA

    • UWP: NA

  • Android Support Library Version: NA
  • Nuget Packages: Prism.DryIoc.Forms, Toast.iOS, Xamarin.FFImageLoading, Xamarin.Forms
  • Affected Devices: iPhone 7 Plus - 2, iPhone XS Max 12.1 Simulator

Screenshots

Will get back to this

Reproduction Link

Will get back to this

in-progress inactive iOS 🍎 proposal-open enhancement ➕

Most helpful comment

Can confirm this. We need https://github.com/xamarin/Xamarin.Forms/pull/5299 DisabledTextColor. The default disabled button color on iOS is not visible on a green button. Hope this gets merged soon.

>All comments

Can confirm this. We need https://github.com/xamarin/Xamarin.Forms/pull/5299 DisabledTextColor. The default disabled button color on iOS is not visible on a green button. Hope this gets merged soon.

Was this page helpful?
0 / 5 - 0 ratings