summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/GalleryPages/AlertGallery.cs
blob: 8a666a100ddd3834e09d927917b0b60d065dc26b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using Xamarin.Forms;

namespace Xamarin.Forms.Controls
{
	public class AlertGallery : ContentPage
	{
		public AlertGallery ()
		{
			var lblResult = new Label { Text = "Result: ", AutomationId = "testResult" };

			var btn1 = new Button { Text = "Alert Override1", AutomationId = "test1" };
			btn1.Clicked += async (sender, e) => {
				await DisplayAlert ("TheAlertTitle", "TheAlertMessage", "TheCancelButton");;
			};

			var btn2 = new Button { Text = "Alert Override2", AutomationId = "test2" };
			btn2.Clicked += async (sender, e) => {
				var result = await DisplayAlert ("TheAlertTitle", "TheAlertMessage", "TheAcceptButton", "TheCancelButton");
				lblResult.Text = string.Format("Result: {0}", result);
			};

			Content =  new StackLayout {  Children = { lblResult, btn1, btn2 }};
		}
	}
}