0899-201611 Using svg for Icon on Xamarin.Forms TabbedPage items !

A drawback of Xamarin.Forms is that is is a closed framework, where lots of classes and methods are internals and private.
This makes hard to find extensibility points to change a specific hard coded behavior of this framework.
So for the current version of Xamarin.Forms, I finally found a way to make this possible: using custom tab renderers.

Gist of the tab renderers for ios and android:


To use XamSvg icons in you tabs:
- add the 2 files in the gist to you ios and android projects respectively
- Use res:xxx as the Icon on you tab's content page to use xxx.svg as the tab icon

    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                Title="Tab name"

The main code for the renderers is a copy of the Xamarin.Forms renderers source code.
A pull request has been made in the Xamarin Forms repo so in the next Forms version a subclass of the renderer can be used instead of a full copy which can't use Forms internal/private classes. The PR for Android is already accepted. The PR for iOS is on its way.

Hope you like it :)
Benjamin Mayrargue

Feedback and Knowledge Base