2

So I'm trying to add a company logo to the middle of my NavigationPage Title section, and I have tried to use NavigationPage.TitleIcon="companytitleicon.png" inside XAML, but it doesn't display. I'm not certain if it's because the image has to be a certain size, and I cannot find information in the documentation.

I played around with other code as well, like calling NavigationPage.SetTitleIcon which takes a reference to a page and a FileImageSource like so:

NavigationPage.SetTitleIcon(this, "/Assets/dischemtitleicon.png");

I may be using it incorrectly, so I need a bit of advice, in general, with getting the logo to display on the Title section. I'll add a screenshot as well to specify the location and size of the logo. The logo is at least twice as wide as the height, eg. 120 x 50 ...

enter image description here

Any assistance will be truly appreciated. I'm also trying to get the colour of the MasterDetail bar to change, but that's not as crucial of an issue. (I added a global StaticResource that applies a fixed colour to all NavigationPage BarBackgroundColors)

Aftab H.
  • 1,517
  • 4
  • 13
  • 25
Cyfer
  • 93
  • 10
  • I know it is an old question but please check if my post answers your question. Thanks. – Cfun Dec 09 '20 at 06:59
  • 1
    @Cfun I still have the project files handy, so I will take a look and let you know asap, thank you so much for the response, I had recently wondered if I would ever get one. – Cyfer Dec 17 '20 at 11:21

1 Answers1

0

If you are using a Xamarin.Forms app based on Shell then you can easily achieve this using Shell.TitleView without the need of a custom renderer, define your title content, bind it or even style it as you like.

You could refer to my similar answer https://stackoverflow.com/a/65062752/522820

Cfun
  • 8,442
  • 4
  • 30
  • 62