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.
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 18.104.22.168. See sample project to reproduce.
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.
@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"
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.
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).