Using standard Icons for NavigationBar in Xamarin Forms

johanksonjohankson Johan KarlssonSEInsider, University ✭✭

Hi!

Is there a way to use OS specific icons on a certain platform in Xamarin Forms?

For example, on iOS I would like to use UIBarButtonSystemItemAdd and on WP/droid a custom image.

  <ContentPage.ToolbarItems>
    <ToolbarItem Name="Add" Command="{Binding ShowAddSheet}" Icon=" magic here " />
  </ContentPage.ToolbarItems>

Thanks

// Johan

Best Answer

Answers

  • johanksonjohankson Johan Karlsson SEInsider, University ✭✭

    Thanks Torben! I was afraid that I had to create a renderer. :)

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    I also messed with the UIBarButtonItems. But what I saw is, when you define the ToolbarItems with an Icon like you did in your sample, then the resulting UIBarButtonItem will not have a Title set (or at least it was like that when I last debugged it). This means that you cannot use a default image on the other platforms and just replace it with the iOS icon on iOS.

  • johanksonjohankson Johan Karlsson SEInsider, University ✭✭

    Ok, I'll look into that! Thanks for the input!

  • AnthonyRamirezAnthonyRamirez Anthony Ramirez USUniversity ✭✭✭
    edited September 2015

    @TorbenKruse

    I REALLY like the ability to use the platform specific icons using the code above.

    Thanks :)

  • lthibodeauxlthibodeaux Lindsey Thibodeaux USMember ✭✭

    @TorbenKruse Is this approach still functioning? I've recreated the array of UIBarButtonItem and assigned it to the RightBarButtonItems property successfully in my own code, but the original text-only buttons are still displayed.

  • VictorHGarciaVictorHGarcia Victor Hugo Garcia USUniversity ✭✭

    The iOS render works very good. I'm wondering if you have a render for Android.

Sign In or Register to comment.