Bug 40251 - Cannot style Buttons natively using UIButton.Appearance
Summary: Cannot style Buttons natively using UIButton.Appearance
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS (show other bugs)
Version: unspecified
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-04-08 22:43 UTC by Joe Manke
Modified: 2017-07-13 07:18 UTC (History)
6 users (show)

See Also:
Tags: ac iOS
Is this bug a regression?: ---
Last known good build:

Reproduction with workaround renderer (11.85 KB, application/zip)
2016-04-08 22:47 UTC, Joe Manke

Description Joe Manke 2016-04-08 22:43:44 UTC
Attempts to use the Appearance proxy in native iOS to style buttons fails, due to the use of UIButtonType.RoundedRect when constructing the native control in the default ButtonRenderer.  UIButtonType.RoundedRect was deprecated in iOS 7, and replaced by UIButtonType.System, which ignores properties from the Appearance. Therefore, using the Appearance property to attempt to style buttons in a Xamarin.Forms app fails.

When properties are set on UIButton.Appearance, Button properties should match this when not set explicitly otherwise.

Button properties do not match UIButton.Appearance.

> UIButton.Appearance.SetTintColor(UIColor.Red, UIControlState.Normal);
Default Button.TextColor appears as blue.

In the ButtonRenderer, replace
> this.SetNativeControl(new UIButton(UIButtonType.RoundedRect));
> this.SetNativeControl(new UIButton(UIButtonType.Custom));

Extend ButtonRenderer, use UIButton.Appearance in default cases. See attachment.

RELATED: https://bugzilla.xamarin.com/show_bug.cgi?id=25209
Comment 1 Joe Manke 2016-04-08 22:47:40 UTC
Created attachment 15663 [details]
Reproduction with workaround renderer
Comment 2 adrianknight89 2016-11-21 05:39:57 UTC
See https://github.com/xamarin/Xamarin.Forms/pull/554
Comment 3 Rui Marinho 2017-03-20 16:01:49 UTC
Should be fixed on 2.3.5-pre1
Comment 4 Jacky Waswani 2017-07-13 07:18:45 UTC
Have verified the bug with latest forms build version

Issue is seems to be fixed with latest build.

Screen cast : https://www.screencast.com/t/NldOZDhQGOcM

Build Info: https://gist.github.com/gangrade-swati/4c84bc1572bfab6ebf93774e9fe22af6

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

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.

Note You need to log in before you can comment on or make changes to this bug.