Xamarin Maui DisplayAlert or pop-up is one of the most fundamental parts of the Maui app. Today in this article I will show you how you can fix pop-ups not showing any display alert in the Xamarin Maui iOS app.
Problem: Xamarin Maui DisplayAlert or pop-up not working on iOS
Solution: The solution to this problem is by using the pop-up class show alert method. Before going to fix things you have to know about the types of popups in Dot net Maui.
There are three types of popups are used in page class of .NET Multi-platform App UI. These are:
The display alert method is frequently used to show any pop up. For this purpose, you have to awaited the method with returning the task and setting a button of your own choice. For example.
If you want to use Ok button with message then you can write the code such as:
await Popup.ShowAlert("This is a message", "Title", "OK");
You can also set up multiple buttons for the user with passing string arrays.
await Popup.ShowAlert("This is a message", "Title", new string[] {"OK", "Cancel"});
Using multiple buttons you can get each string returning from a specific button pressed.
Here is a complete method of how you can DisplayAlert or pop-up in the Xamarin Maui iOS app
- 1) create a default Xamarin Maui project
- Go to App.Xaml.cs file file and change the status file which is going to be open in first.
- Here I am using in navigation page so you have to change the code such as:
- In the main page you can set up a button which will perform navigation from one page to another.
- Behind this button, you have to set up on counter-click event with this code
- Now run the program on Android or iOS
0 Comments