
Hosting Native Controls – Moving from Xamarin Forms Renderers to Uno Platform Controls
Share on twitter Share on linkedin Share on reddit In this blog post we will look at a common technique in Xamarin Forms to customise native platform controls and how we can achieve the equivalent result using Uno Platform. You can follow along with the source code for both the Xamarin Forms and Uno Platform projects used in this blog. What are Renderers? First let’s look at what a custom renderer is and why you might use one. Xamarin Forms provides a hierarchy of UI controls which can be created in code or XAML. The framework contains controls for all the common controls on each supported platform even though the functionality varies from iOS, Android, and other operating systems. Therefore, each control contains firstly the cross-platform control code, which defines the dependency properties, methods and events which form the public API for the control. Additionally, there is a renderer required for each native platform. The job of the renderer is to map the native API to the public Xamarin Forms API and handle drawing and appearance so that the control behaves correctly in the Xamarin Forms layout system. The amount of work a renderer must do depends on how closely the native control