I am following these tutorials to implement Searchbar
in NavigationPage
in Xamarin.Forms:
- Searchbar in Navigation bar Or TabbedPage
- How to add search bar in navigation bar in Xamarin forms
- A iOS and Android app to monitor the views and clones of your GitHub repos
- Xamarin Forms - ContentPage with SearchBar in the Navigation bar .
I have a simple ContentPage
which I open in App.cs In NavigationPage
form:
var navigationPage = new Xamarin.Forms.NavigationPage(new Home());
navigationPage.On<iOS>().SetPrefersLargeTitles(true);
MainPage = navigationPage;
While running the project I get error in Renderer Page in the following line:
Toolbar GetToolbar() => CrossCurrentActivity.Current.Activity.FindViewById<Toolbar>(Resource.Id.toolbar);
the exception thrown is:
System.InvalidCastException: 'Unable to convert instance of type 'Android.Support.V7.Widget.Toolbar' to type 'Android.Widget.Toolbar'.'
I can't figure out why this error appears, although it shows that it has problem in casting.
Does anyone see where is my error?