Getting Started with Xamarin and Xamarin.Forms

Getting Started with Xamarin and Xamarin.Forms


With any new technology, there’s usually a fairly long learning curve associated with trying to become productive with using that new technology, and developing mobile applications with Xamarin is no exception. Once you get past all the startup knowledge you’ll need though, you should find that you’re picking up momentum pretty quickly. Below, some tips have been included to help shorten that learning curve for you, so that you’ll be able to become productive a little more quickly and start enjoying the thrill of being a successful Xamarin developer.


Navigation Between Screens

Xamarin.Forms screens are managed by using a stack, from which you can push and pop individual screens, which by the way are referred to as Pages, belonging to the base class ContentPage. Before you can begin working with these Pages, you’ll need to establish a Navigation Stack, and the simplest way to accomplish that is by starting your new application off with a NavigationPage. Once you’ve done that it will be possible from inside a ContentPage to make use of the built-in Navigation service to push a new page to the top of the stack.

The commands necessary to accomplish this are:

MainPage = new NavigationPage( new FirstPage() );

await Navigation.PushAsync( new SecondPage() );

Laying Out Content

There are a number of different layout patterns available in Xamarin.Forms, some of which are

  • Absolute Layout,
  • Relative Layout,
  • Grid Layout and
  • Stack Layout.

As you experiment with each of these and some of the others available, you’ll probably come up with a personal favorite and use that for much of your development work. However, for the purpose of becoming productive as quickly as possible, you may want to start out using the Grid layout option, because it’s extremely flexible while still providing lots of performance capabilities that you’ll appreciate.

Seeing Your Design

There are a few ways that you can see your design as you’re proceeding with development, and this, of course, is extremely useful so that you can make whatever tweaks may be necessary to optimize your design during the process. Xamarin Live Player is one of the tools you can use for editing XAML right in the text editor and instantly seeing the results of your work. Xamarin.Forms Previewer is another tool you can make use of for getting live feedback on your last set of changes or additions. You can even use applications like Reflector on a development machine to mirror your device.

Finding Controls

For whatever platform you’re targeting, there are a great many native UI controls provided by Xamarin.Forms, and you can get an idea of these by taking a look at Renderer Base Classes and Native Controls. If you don’t find what you’re looking for there, there are also some good third-party controls available which can extend each of the platforms, and which you can find with some quick searches.

Customizing a Control

Basic customization options are included right out of the box with Xamarin.Forms, but there are some additional options available if you get stuck and need a little help getting back on track:

  • Platform Specifics – for those cases where you want to customize a control for a specific platform only, you can use platform specific to get the job done. For instance, you might want to adjust an entry’s font size, to make sure it fits the control width.
  • Custom Renderers – this can be used when you need to have complete management over the design and behavior of a native platform control. Custom Renderers can also be used when you want to implement a control that does not exist within Xamarin.Forms.
  • Effects – this is really handy when it’s necessary to modify a property which is not exposed in the current control abstraction, or when you have to add some kind of customization to a control for each of the platforms.


What Is React Native and Why It Is the Leading Development for Mobile Apps?

Business who want custom app development for both iOS and Android should choose to React Native app development. Check out our article to learn about the importance of building apps in React Native.

Using Custom Fonts

Xamarin.Forms do include a great deal of support for fonts, including management of all the font attributes, but when you need to create a custom font for an application, it takes a little bit more doing. First, you’ll need to set up the font in platform projects, and then you can use it in XAML so attributes can be assigned across whichever platforms you need.

Storing Images

Since each of the platforms has its own way of managing images, and because each supports different densities and sizes, storing images takes a little effort in Xamarin.Forms. You can consult this handy reference to learn where each platform expects to find images, and how they should be loaded to those locations. Once your images have been properly placed, it will be a simple matter to reference them in your code, and then the specific platform will deliver the image as requested, with the appropriate density.

Storing Local Data

Each of the different platforms has its own API for managing storage, which Xamarin.Forms discover through Application.Current.Properties. If your local data storage needs are relatively simple, this will do just fine, but if you have to manage something a little more complex, you may have to try something a bit more sophisticated like Azure Mobile Apps or SQLite.


As soon as you begin coding, developing, and testing, you’ll start picking things up in Xamarin very quickly, so that learning curve won’t seem so steep, but in the beginning, you’ll probably run into a few situations that have you scratching your head. Some of the most common beginner questions have been answered above, but there are undoubtedly tons more which you’ll run into in your quest to achieve productivity.

One great resource for finding out all the tools which are at your disposal in Xamarin is this Xamarin Tools and Resources blog posting. By the time you’ve browsed through this excellent resource, you will be equipped with much of the knowledge you’ll need to have a great start as a Xamarin developer. From there, it won’t be long before you’re building worthwhile mobile applications that you’ll be proud of, and that users will find very useful.

Open chat
Chat with our Experts!
Can I help you?