Issue
As you can see my SearchBar doesn't have an 'X' button, which is normally at the right hand side of the SearchBar. I only have the issue using Android, iOS has an X and a cancel button. Do I need to add a tag in or what am I doing wrong?
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BottleShop.Views.Products">
<NavigationPage.TitleView>
<StackLayout BackgroundColor="Red" HorizontalOptions="FillAndExpand" VerticalOptions="StartAndExpand" Orientation="Horizontal">
<SearchBar x:Name="Search" TextColor="Black" BackgroundColor="Purple" TextChanged="Searc_TextChanged" HorizontalOptions="FillAndExpand" Placeholder="Search..." PlaceholderColor="Gray" VerticalOptions="StartAndExpand"/>
</StackLayout>
</NavigationPage.TitleView>
<ContentPage.ToolbarItems>
<ToolbarItem Name="CartImage" Icon="ShoppingCart.png" Priority="0" Order="Primary" Activated="Clicked"/>
<ToolbarItem Text="{Binding NoItemsInShoppingCart}" Priority="0" Activated="Clicked" Order="Primary"/>
</ContentPage.ToolbarItems>
<ContentPage.Content>
Xamarin.Forms v5.0.0.2012
Solution
Remove
NavigationPage.TitleView
Or
StackLayout BackgroundColor="Red" HorizontalOptions="FillAndExpand" VerticalOptions="StartAndExpand" Orientation="Horizontal"
If the SearchBar surrounded by NavigationPage.TitleView and StackLayout, the 'X' button will disappear. Remove anyone of them can solve the problem.
Answered By - Steven-MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.