0

in my page, i added a SearchBar above a ListView. It works good but i see a small line between the NavigationBar and the SearchBar. Anyone knows how to remove it? Thanks

    <StackLayout Orientation="Vertical">
    <SearchBar 
        CancelButtonColor="White"
        BackgroundColor="{x:Static local:Consts.PrimaryColor}"
        IsVisible="{Binding IsSearchVisible, Mode=OneWay}"
    />
    <ListView

Space between navigation bar and search bar

esskar
  • 10,638
  • 3
  • 36
  • 57

1 Answers1

2

To remove bottom shadow line you can use custom renderer. That going to do exactly what you need.

[assembly: ExportRenderer(typeof(NavigationPage), typeof(NoLineNavigationRenderer))] 
namespace MyMobileProject.iOS {
    public class NoLineNavigationRenderer : NavigationRenderer {

        public override void ViewDidLoad(){
            base.ViewDidLoad();
            // remove lower border and shadow of the navigation bar
            NavigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
            NavigationBar.ShadowImage = new UIImage ();
        }
    }
}

For more information you can visit this

R15
  • 13,982
  • 14
  • 97
  • 173