XamarinForms 101: How to use Acr.UserDialogs

Are you looking for a pop-up plugin that you can use for your Xamarin projects?

Want to see how Acr.UserDialogs work and some samples?

In this post, you will learn how to use Acr.UserDialogs Nuget package by Allan Richie through a step-by-step process.

 

Step 1:

The first step is to right-click on your Solution. Then go to Manage NuGet Packages for Solution.

 

Step 2:

On the browse tab, type acr user dialogs. Look for Acr.UserDialogs by Allan Ritchie.

 

Step 3:

Install the Acr.UserDialogs Nuget package on each project in your solution

 

Step 4

Call UserDialogs.Init(this) on your Android project only. For iOS project, nothing is necessary any longer as of v4.x. There is an Init function for iOS but it is OPTIONAL and only required if you want/need to control the top level viewcontroller for things like iOS extensions. Progress prompts will not use this factory function though.

Let’s put it on MainActivity.cs of our Android project.

 

Step 5:

Create the UI for the Acr.UserDialogs sample functions.

 

Step 6:

Write your Acr.UserDialogs functionalities here.

 

Step 7:

And for the demo.

 

 

Here’s the sample code of Acr.UserDialogs.

GitHub: https://github.com/webmasterdevlin/AcrUserDialogs-Sample

 

Wrapping up, the cross-platform libraryAcr.UserDialogs has plenty to offer that allows you to call for standard user dialogs from a shared/portable library. It supports Android, iOS, and Unified Windows Platform (UWP, UAP). Try it and explore its other methods and properties.

Happy coding!

4 Comments

  • Andreas A. Nesheim

    Great post! I think you have a typo in step 4, where you say you have to call CachedImageRenderer.Init() . Don’t you mean UserDialogs.Init() ?

    • Devlin

      Thanks, Andreas! I’ve updated it.

  • Huang Jia Wu

    Hello, thanks for sharing, and any suggestions for using this plugin in xamarin.forms with prism?

    Because when I call Loading in prism event onnavigationto, won’t show dialog in ios but android is working fine

    I need initial it?

    Thanks again

    • Devlin

      Have you tried OnNavigatingTo and OnNavigatedTo?

Post A Comment