0

In a "xamarin forms shell" application, how do I add a logo image in the center of the header toolbar?

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage.ToolbarItems>
    <ToolbarItem IconImageSource="mytoolbaritem.png"
             Order="Primary"
             Priority="0"/>
</ContentPage.ToolbarItems>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             Shell.NavBarIsVisible="True"
             mc:Ignorable="d"
             x:Class="MyApp.Views.HomePage" BackgroundColor="White">
    <ContentPage.Content>
        ...
    </ContentPage.Content>
</ContentPage>

enter image description here

Anatoly
  • 20,799
  • 3
  • 28
  • 42
001
  • 62,807
  • 94
  • 230
  • 350
  • can u try this answer https://stackoverflow.com/questions/64798384/how-could-i-change-the-navigastions-page-arrow-in-xamarin-forms/ – Ronak Shetiya Dec 16 '20 at 05:34

1 Answers1

2

You can Display views in the navigation bar by customize Shell.TitleView inside ContentPage:

<ContentPage ...>
    <Shell.TitleView>
        <Image Source="xamarin_logo.png"
               HorizontalOptions="Center"
               VerticalOptions="Center" />
    </Shell.TitleView>
    ...
</ContentPage>
nevermore
  • 15,432
  • 1
  • 12
  • 30