Learn how Xamarin.Forms allows you to create a cross-platform mobile application with a single shared UI.
- [Instructor] Xamarin is a set of tools that enables you to build cross-platform mobile applications using C#. The use of a single language enables a significant amount of code sharing across applications, saving greatly on development time, maintenance, and allowing you to focus on application logic. Xamarin.Forms extends that concept with sharing of user-interface definitions. Pages or views and their related models can be defined in a single library and shared across all the mobile-application platforms. The best part about this is that you define user interface once using common controls and layouts, and those interfaces are rendered on each platform using native controls that map to the common definitions.
You get a native UI on multiple platforms without having to build the UI for each of those targeted platforms. There're sole capabilities in Xamarin.Forms that support this shared code model. Messaging center is for sending asynchronous messages between code. As you change between native code and your shared code, this becomes extremely important. Dependency service is a platform-dependency injection or enables you to create platform-specific implementations that are callable from your shared code.
And native controls, native views, custom renders, and other tools support combining the Xamarin.Forms-shared interface with any native-UI elements, enabling you to render native-UI controls in your Xamarin.Forms or to embed Xamarin.Forms inside native controls. In my other course, Xamarin Essential Training: Building Your First App, I showed you how to build a Xamarin application where you created a native UI for each mobile platform. In this course, you'll see a different approach to building an application where you'll create a single UI using Xamarin.Forms.
Both approaches are valid. You may choose a native approach if you've got expertise in the individual platforms, or if you have requirements to fine-tune some of the user interface elements or interactions. Xamarin.Forms may be the application choice for you if you're looking at speed to development, if you're looking at ultimate reuse of those user-interface components.
- Creating a Xamarin.Forms solution
- Navigating between pages
- Screen layouts and controls in Xamarin.Forms
- Data binding
- Adding style to a control
- Using a Xamarin.Essentials package
- Embedding native controls in your shared forms
- Writing custom renderers