Search code examples
iosxamarin.iosmauimaui-community-toolkitmaui-ios

.Net MAUI Search-Bar control issue on iOS devices


I am building a .NET MAUI Android and iOS application and I implemented Search-Bar on a few places in the application.

As for my Android devices, everything works as expected, but the issue occurs when I run my application on iOS. For some reason Search-bar is not displayed at all (in either of those places (popup models, pages etc...))

I tried to fix this by setting SearchBar Style on iOS to Minimal, since I've read this could resolve the issue but it didn't help:

<ContentPage ...
             xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls">
    <StackLayout>
        <SearchBar ios:SearchBar.SearchBarStyle="Minimal"
                   Placeholder="Enter search term" />
        ...
    </StackLayout>
</ContentPage>

Solution

  • I Managed to resolve this by using Entry instead of SearchBar.

    <Entry
        x:Name="SearchEntry"
        Placeholder="Search.."
        TextChanged="OnSearchTextChanged"
        WidthRequest="150"
        HorizontalOptions="Center"
        FontSize="12"/>