'How to change the cancel icon in Xamarin Forms Shell SearchHandler
I have a Xamarin Forms Shell app where I have implemented the Shell SearchHandler. The cancel button shows a book image.
This only occurs on iOS - on Android, there is no cancel button.
My xaml looks like this:
<Shell.SearchHandler>
<controls:RouteSearchHandler
x:Name="RouteSearch"
BackgroundColor="White"
ClearPlaceholderCommand="{Binding ClearSearch}"
ClearPlaceholderIcon="{StaticResource Cancel}"
DisplayMemberName="Street1"
SearchBoxVisibility="{Binding TopSearchVisibility, Converter={StaticResource visibleConvert}}"
ShowsResults="True" />
</Shell.SearchHandler>
How do I change the cancel icon from a book to another fonticon or image?
Solution 1:[1]
It seems a potential issue , the team set a default(book) icon on Clear button.
Workaround
You can prepare a small/transparent image and place it in Resources folder in iOS project , and set ClearPlaceholderIcon
with it, then the problem should be solved .
And Feel free to file the feature request on github :https://github.com/xamarin/Xamarin.Forms/issues.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |