So, what is Xamarin Forms?
Xamarin Forms is a library that enables you to build native apps for iOS,
Android, and Windows using a single C# code base.
Build stunning cross-platform user interfaces
Xamarin.Forms is an open source cross-platform framework from Microsoft for building iOS, Android, & Windows apps with .NET from a single shared codebase.
Use Xamarin.Forms built in pages, layouts, and controls to build and design mobile apps from a single API that is highly extensible. Subclass any control to customize their behavior or define your own controls, layouts, pages, and cells to make your app pixel perfect.
Xamarin extends .NET
Xamarin extends the .NET platform with tools and libraries specifically for building apps on iOS, Android, macOS, and more.
These are some things that Xamarin adds to the .NET platform:
- Base framework for accessing native features
- Extensible Markup Language, known as XAML, for building dynamic mobile apps using C#
- Libraries for common patterns, such as Model View ViewModel(MVVM)
- Platform specific libraries that includes access to APIs from Google, Apple, Facebook, and more to add rich capabilities
- Editor extensions to provide syntax highlighting, code completion, designers, and other functionality specifically for developing mobile pages
If you have any experience with Windows Presentation Foundation or Silverlight,
Xamarin forms will be very familiar to you.
So we have this XML based language called XAML which stands for
eXtensible Application Markup Language and we
use this to define the user interface of our applications.
For example, we can define what elements we have on a page,
where they are located, and what do they look like.
Behind every XAML file we have what we call a Code-behind
which is basically a class that implements the behavior for that page.
For example, what should happen when we click a button or select an item from a list.
So these are the responsibilities of the Code-behind.
Now in terms of architecture,
Xamarin Forms is built on top of
two existing libraries, Xamarain.Android and Xamarin.iOS.
So with Xamarin Forms we work with a single unified API for creating user interfaces and
Xamarin forms will internally map
these user interface elements to their corresponding native equivalent,
and this makes our applications completely native.
So we don’t have user interface elements that look the same across different platforms.
If you use a button, that button looks
different depending on where you run your application.
Also, because Xamarin Forms is built on top of Xamarin.Android and Xamarin.iOS,
you can write platform specific code that uses the API exposed by any of
these libraries so you’re not limited to
a common set of features that are available across all these platforms.