Is there any way to add background Image on navigationbar page by page on xamarin forms?
1 Answers
The would need to write a custom render to change the background of the navigation bar. This is simply because the navigation bar does not have an option to change the background image.
There's a good very brief section about how to write custom renders is this ^ book (you can even find it in the preview without purchasing it).
An alternative solution would be to create a custom banner at the top of the page
https://forums.xamarin.com/discussion/126227/customizing-navigation-bar-or-action-bar-in-xamarin-forms[As mentioned in this answer2
<ContentPage NavigationPage.HasNavigationBar="false">
<StackLayout VerticalOptions="Start"
HorizontalOptions="FillAndExpand"
Orientation="Horizontal"
Padding="10,5,10,5>
<Image HorizontalOptions="StartAndExpand" source="yourimage.png"/>
<Label HorizontalOptions="CenterAndExpand" Text="ALL"/>
<Image HorizontalOptions="EndAndExpand" source="yourimage.png"/>
</StackLayout>
<StackLayout>
<!-- Place your code for page body-->
</StackLayout>
</ContentPage>
I've copied the code into here for simplicity and reference. This solution removes the navigation bar and allows you to create a custom banner on each page in XAML. In here you can change the layout as you please.

- 31
- 2