Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
On iOS, the ButtonRenderer uses a UIButtonType.RoundedRect. It is desirable to be able to change this so that customizations can be done. For example, when trying to set a background images for state changes, UIButtonType.Custom should be used because RoundedRect has some built-in functionality that messes with this.
>var nativeButton = UIButton.FromType(UIButtonType.Custom);
>nativeButton.SetBackgroundImage(UIImage.FromBundle("greenButton.png").StretchableImage(12, 0), UIControlState.Normal);
>nativeButton.SetBackgroundImage(UIImage.FromBundle("greenButtonActivated.png").StretchableImage(12, 0), UIControlState.Highlighted);
The above code is an attempt to get the images working correctly. UIButtonType.Custom is needed because RoundedRect changes the opacity of the control when UIControlState.Highlighted is true, which is not what is wanted when specifying an image. Doing the above works, but now the other properties are not working - Clicked events, etc.
An event can be manually added back in, but then the Command binding for the custom Button class is broken.
**Build Date & Platform:**
I have not found a suitable workaround to use UIButtonType.Custom and have all the default things still be in place like Clicked and bindings, etc.
Thank you for your feature request, we will take your feedback into consideration.