A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
In .NET MAUI 10 on iOS, the visual appearance of SearchBar is controlled by the native UISearchBar, including its style and background behavior. The UISearchBarStyle.Minimal style specifically removes the bar background and renders the search field itself as a translucent element, which causes:
- The search field color to be composited with the page background, making the color appear lighter/darker than the solid
Redused on the surrounding layout. - A subtle shadow/blur around the control as part of the native iOS rendering.
Setting only handler.PlatformView.BackgroundColor and BarTintColor while using UISearchBarStyle.Minimal does not override this compositing behavior, so the search field will not match the solid Red of the BoxView, and the shadow remains.
To get a solid background color that matches the surrounding layout and avoid the translucent effect, configure the iOS-specific SearchBarStyle to a style that has a background instead of Minimal, for example:
<ContentPage
xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls">
<Grid>
<SearchBar
ios:SearchBar.SearchBarStyle="Prominent"
BackgroundColor="Red" />
</Grid>
</ContentPage>
or in C# using the fluent API:
using Microsoft.Maui.Controls.PlatformConfiguration;
using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;
searchBar.On<iOS>().SetSearchBarStyle(UISearchBarStyle.Prominent);
searchBar.BackgroundColor = Colors.Red;
Prominent and Default styles keep the bar background and avoid the strong translucency of Minimal, so the BackgroundColor applied to the SearchBar will be much closer to the solid Red of the surrounding view, and the perceived “darkening” caused by the translucent overlay is removed.
The subtle shadow is part of the native control’s visual design and is not removed by MAUI APIs; however, switching away from Minimal eliminates the gray halo effect that comes from the translucent blending with the page background.
References: