Xamarin - Xamarin.Forms Renderer Reference

April 17, 2015 // By Kevin Ford

Now that I've spent some time working with writing custom renderers with Xamarin.Forms I've found that one of the easiest ways to extend an existing control is to also extend the an existing platform renderers. For example, when I created an ImageButton for the Xforms-Toolkit, I extended the existing ButtonRenderers for the three platforms. This seemed easier to me than extending the base renderers for the three platforms and starting from scratch. What I found as I continued to work creating custom renderers is that I was being frustrated by not always knowing what renderer was associated with a particular Xamarin.Forms control for a given platform and what native control or controls were being created under the covers by the renderer.

To help with this I put together this guide to list what renderers are associated with what Xamarin.Forms controls and what native control or controls are being created by the platform specific renderers.

This guide was update using Xamarin.Forms version 1.1.0.6201, which is the latest version at the time of this page's last edit.

With the 6201 release many of the inconsistencies in the controls have been address but some still exist. Sometimes the Windows Phone renderers were creating the native controls by loading an Xaml file or pulling the native control out of Application.CurrentResources. In these cases I was not able to tell exactly what native controls were being created.

Base Renderer

To start with, all renders usually derive from a platform specific base renderer class that in turn inherit from a platform specific control. If you want to create platform specific renderers from scratch you are probably going to be deriving them from the correct platform's base renderer class. These have been substantially standardized in version 6201 with all controls inheriting from a generic version of ViewRenderer. There is also a non-generic version that appears to be used sometimes by navigation controls. The methods on these classes are also more in line with each other than they had been but still not the same. For example the iOS version has a method called ViewOnUnfocusRequested while the Android's version of the same method is called OnUnfocusRequested.