1
votes

Hello all great people in here

I am heading for creation of a Xamarin.Forms app.

I have taken a look on this link https://developer.xamarin.com/guides/xamarin-forms/custom-renderer/entry/, where they are going to make the renderer for components platform-specific. An example can be TwinTechs Controls, which is only available for iOS and Android. How can this be done?

Is that possible? And if it, how?

1

1 Answers

2
votes

The Renderer class is the custom platform-specific that you need to customize per platform.

In that particular example they are looking at changing an existing renderer.

You will be more focused in writing your own platform-specific components from scratch.

To do so you will want to inherit from ViewRenderer and supply reference to the View and also the platform-specific native element that will be the root of the control on the platform level.

Don't forget to export the renderer also, for it to be used in the rendering process of the page in Xamarin.Forms, from the platform level along the lines:-

[assembly: ExportRendererAttribute(typeof({ViewNameHere}), typeof({RendererClassNameHere}))]

There is a useful tutorial on writing custom renderers here that will help you further.