What is Xamarin Forms?

A free video tutorial from Mosh Hamedani
Helping Learners Build Successful Coding Careers
Rating: 4.6 out of 5Instructor rating
20 courses
805,050 students
What is Xamarin Forms?

Learn more from the full course

Xamarin Forms: Build Native Cross-platform Apps with C#

Learn to build native mobile apps for Android, iOS and Windows using your existing C# skills

07:25:54 of on-demand video • Updated April 2018

Build native mobile apps for Android, iOS and Windows using C#
Understand the fundamentals of Xamarin Forms and its architecture
Build user-interfaces with XAML and code
Work with images
Present data in beautiful, interactive lists
Implement multi-page apps with navigation, tabs, master/detail pages
Build forms and setting pages
Store and retrieve data from a variety of sources (file system, SQLite database and RESTful services)
Implement Model-View-ViewModel (MVVM) architectural pattern
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. 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. Now the first question that a lot of beginners asked me is, Mosh, do I need to know about Xamarin.Android or Xamarin.iOS in order to learn Xamarin Forms. Not at all. The only exception is if you want to write something specific for Android or iOS, otherwise for the most part you can learn Xamarin Forms on its own. The second beginner's question is, how do I know which Xamarin products should I use? Should I use Xamarin Forms or one of the more specific libraries? The answer is, it depends. What makes Xamarin Forms powerful is the ability to share most, if not all your code, across these platforms. So you code the application once and then build it for different platforms. This building is nothing more than just a compile in Visual Studio. That's all you have to do. So, if you don't need to use much of the platform specific functionality and code we use is more important to you, then go for Xamarin Forms. Otherwise, if you're going to do a lot of customization and have quite a few use cases for working with platform specific API then it's better to use Xamarin.Android or Xamarin.iOS. In terms of tooling you have a few options here. If you have a Windows machine you can build and deploy apps to Android and Windows but not iOS. For that you need a Mac, either a MacBook Pro or an Imac. On the other side, if you're a Mac user, you can build apps for Android and iOS but not for Windows. So if you want to target all platforms, you need both a Windows and a Mac machine but this is not a requirement to take this course or to learn Xamarin Forms in general. It's all about where you want to deploy your application. You can start with a Windows machine and use Visual Studio to build apps for Android and Windows. If, in the future, you want to build your app for iOS, you just add a Mac to your setup and you're pretty much done. You don't need to write any new code. You just build your project for iOS. All right, next I'm going to show you how to set up your development environment.