Surely you have interacted with applications that do not inform you exactly what is happening, they simply remain static and do not indicate that the application is loading a process and that is why it does not allow you to continue interacting until it is completed… It has also happened to me. Keeping a user informed about the processes of an App makes their experience much more pleasant and communicative, in this case, the ActivityIndicator allows us to visually inform the user that they should wait because a process is running. In this post, we will learn how to use the activity indicator to keep our users happily informed! 💚
What is exactly an ActivityIndicator?
The ActivityIndicator is already in .NET MAUI! And it helps us to inform the user that your application is performing a prolonged activity, this is done visually through an animation.
The appearance of this control adapts to the platform on which it is running. As you can see in the image below.
Now let’s learn the structure needed to use:
As you can see it is very simple! You just have to add the
ActivityIndicator tags, in addition to the other two properties that I detail below:
🔹 IsRunning: It’s a bool value that indicates whether the indicator will be visible (true) or hidden (false). By default, this property is false.
🔹 Color: It’s a Color value which sets the color with which the ActivityIndicator will be displayed.
Finally, you will have a result like the following:
⚠ These properties are backed by BindableProperty objects.
And… can I do it directly in C#? 🤔
Of course! Here you can see a code example of how to do it!
Thanks for reading! 💚💕
Spanish post: https://es.askxammy.com/activityindicator-en-net-maui/