Understanding Xamarin Forms

Abdelmajid BACO
2 min readJul 22, 2019

Xamarin.Forms” is a cross-platform toolkit that enables .NET developers to build native apps for Android, iOS and Universal Windows using C# and XAML.

XAML is used to build user interfaces and C# used to implement all behaviors and to call the application logic layer.

Xamarin Forms Architecture

Figure 1 : Xamarin Forms Architecture

Xamarin.Forms” is built on top of three libraries, Xamarin.Android, Xamarin.iOS and UWP. Those libraries expose all needs to build native apps for Android, iOS and Universal Windows using C#. All Xamarin libraries provide access to .NET standard library.

Xamarin.Forms” has an assembly called “Xamarin.Forms.Core” that defines common classes and APIs to work with different platforms. For example, when we create a control button or label in Xamarin.Forms project, it will be rendered using the native controls of the target platform. For Android platform, we have the assembly called “Xamarin.Forms.Platform.Android” that is responsible for mapping common controls defined in “Xamarin.Forms.Core” into Android equivalent controls. We call this assembly Renderer Base Classes, we have the same one for iOS called “Xamarin.Forms.Platform.iOS” and for windows called “Xamarin.Forms.Platform.UWP”. The following diagram illustrates this mechanism :

Figure 2 : Relationship between the Xamarin.Forms Views and the corresponding native controls

Common Language Runtime (CLR) is responsible for compiling the C # code into machine code and executing it on the target device. In Xamarin architecture, two implementations runtimes are responsible to execute shared code :

  • The Mono runtime for Xamarin.iOS and Xamarin.Android
  • The .NET Native for Universal Windows Platform

Resources :

--

--

Abdelmajid BACO

Senior Full Stack .Net / Angular Developer, Cloud & Azure DevOps, Carrier Manager, Husband, and Father.