Bug 52602 - SearchBar CancelButtonColor resets when user clicks off it
Summary: SearchBar CancelButtonColor resets when user clicks off it
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-17 13:52 UTC by Paul Brenner
Modified: 2017-02-22 15:01 UTC (History)
4 users (show)

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


Attachments
Sample showing issue (504.80 KB, application/zip)
2017-02-17 13:52 UTC, Paul Brenner
Details


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 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.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description Paul Brenner 2017-02-17 13:52:50 UTC
Created attachment 19864 [details]
Sample showing issue

If you set the SearchBar CancelButtonColor property, it works. But when the user taps off the control to another part of the page, the color resets. Using forms version 2.3.3.180. See sample project to reproduce.
Comment 1 adrianknight89 2017-02-17 23:40:02 UTC
I think this is default behavior. When the search bar is unfocused, the cancel button changes tint to show that. It doesn't matter if you set cancel button color or not. The tint will change regardless (from example from default blue to gray).

That said, I do not know for sure if this is default behavior or a bug. One should check to see how this behaves on Xamarin.iOS / XCode.
Comment 2 Paul Brenner 2017-02-19 19:20:03 UTC
@AndrianKnight, thanks for the reply. It looks like this default behavior for a UISearchBar.

If you set the bar's tintcolor, it behaves like the Xamarin Search bar, the cancel button's color changes, but it goes back to default when it is unfocused.

But, if you do a for loop through the UISearchbar's subviews, and when you find a UIButton change it's Title color for the Normal UIControlState, it behaves as expected. The color of the cancel button is changed, and stays the same when the bar is unfocused.

It looks like we are getting this behavior because even with the Cancel button color set, the Xamarins forms SearchBarRenderer is setting the UIButton's color to default for the disabled state.

I would expect by setting the Cancel Button Color, I'm saying "I want the button's color to always be this"
Comment 3 Paul DiPietro [MSFT] 2017-02-22 14:58:22 UTC
Setting the cancel button's disabled color to something other than the disabled state color is deceptive UI. Considering this affects other users who might not expect such behavior, I don't expect a change like this to be made.
Comment 4 Paul DiPietro [MSFT] 2017-02-22 15:01:37 UTC
That said, I should add that if you feel like making a proposal change for such an API, doing so on the Xamarin.Forms evolution forum (https://forums.xamarin.com/categories/xamarin-forms-evolution) is an option; however, with all honesty, I do feel that this is a somewhat niche addition and would simply clutter the renderer(s).