Common Libraries Used in Xamarin Forms App Development

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.


In this article, we will discuss the libraries that are commonly used in mobile app development. The libraries discussed herein are from the perspective of developing an overall solution. They also suggest the common practices followed in app development.


The following are the commonly used libraries:


The apps developed these days use the MVVM pattern. This pattern helps in segregating the logic from the user interface which, in turn, results in clean and maintainable code. There are different MVVM toolkits available—MVVM Light and FreshMVVM. FreshMVVM is one of the popular and simpler toolkits used to implement the MVVM pattern in Xamarin forms.


In addition, the FreshMVVM package also includes an IOC (Inversion of Control) container. This helps in registering and resolving the different services used in the app.

For example, there is a requirement to share text messages. Because sharing is a platform-level feature, this needs to be implemented in Android and iOS projects. To communicate from Xamarin forms to the platform level projects, we will use dependency service and dependency injection.

We first define an interface, ‘IShareInfo.cs,’ in the Xamarin Forms project. This interface has a method named ‘ShareText’. The interface then is registered with the IOC container in App.Xaml.cs:

var shareService = FreshIOC.Container.Resolve<IShareInfo>();
MainPage = new ShareMessageAppPage(shareService);

This service then is passed as a parameter to the page model’s constructor or to the code behind. In this example, the constructor of the code behind is as shown next:

IShareInfo _shareInfo;
public ShareMessageAppPage(IShareInfo shareInfo)
   _shareInfo = shareInfo;


The FFImageLoading library provides a quick way to load and cache images. It supports images as a URL, from resource files, and also from stream content. It also supports SVG image formats. In addition, it also provides image transformations, such as round images. It has the provision to display a placeholder image while the image is being loaded and also to display an error image when the image is not found.

To use FFImageLoading, add the NuGet package to the Xamarin Forms project and, in the XAML, file add the references for the FFImageLoading as shown in the next code snippet:


Here’s how you can display a normal image as a circular image:

<ffimg:CachedImage WidthRequest="120"
Source="{Binding ImageUrl}">
<ffimgtransform:CircleTransformation />

To display an image in SVG format, use the following code:

<ffimgsvg:SvgCachedImage WidthRequest="20"
Source="image.svg" />


HTTP calls are networking calls and are platform specific. iOS uses NSURLSession to do HTTP calls and Android uses OkHttp. ModernHTTPClient hides the platform-level complexities and makes it simple to call from the Xamarin Forms project. We still use the HttpClient of the System.Net.Http, and pass an object of NativeMessageHandler, a class in ModernHttpClient. Here’s an example:

var httpClient = new HttpClient(new NativeMessageHandler());

NativeMessageHandler also can be used with OAuth authentication by using ThinkTecture. Add the package ‘Thinktecture.IdentityModel.Client’ to the Xamarin Forms project. When creating the OAuth2Client object. pass the message handler as an object. Here’s a way to do that:

var handler = new NativeMessageHandler()
   AutomaticDecompression = DecompressionMethods.GZip

return new OAuth2Client(<Uri address>, clientId,
   clientSecret, handler,

Where Uri address is the endpoint URL for authentication, clientId is the string that uniquely identifies the app, clientSecret is also a string. The handler is an instance of NativeMessageHandler (ModernHttpClient). And, the last parameter is the authentication style, which is set to Basic.


Flowlistview is another helpful library that helps in displaying the multiple records in a row (in multiple columns). The default list allows only one record per row.

Telerik Suite

Telerik provides a list of controls for Xamarin Forms and also for platform-level projects. The sideDrawer, chart, and list view are a few of the controls that can serve many requirements. Side drawer can be used to display different sets of options or action items. It also can be used for context menus. There are a variety of chart options provided by Telerik. However, it’s a paid set of controls.

GCM Client Component

Push notifications is one of the most common features of a mobile app. To enable push notifications on Android, we need a GCM Client component added to the Android project. We define a class that inherits from the GCMServiceBase and is decorated with a Service tag.

[Service]   // You must use the Service tag
public class DemoGcmService : GcmServiceBase
GcmClient.Register(Context, SENDER_IDS);

GcmClient.Register uses the project ID registered in the firebase console site. This then can be integrated with the Azure notification hub to send notifications.


In this article, we reviewed the common NuGet packages and components that can be used in app development. The FreshMVVM package helps you to follow the recommended pattern when developing apps. OAuth authentication is also a common scenario when accessing APIs from the app.


More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read