summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/GalleryPages/ActionSheetGallery.cs
blob: 4f60c1e166533d0598897610bc0fc80673d6f26d (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xamarin.Forms.Controls
{
	public class ActionSheetGallery : ContentPage
	{
		public ActionSheetGallery ()
		{
			AutomationId = "ActionSheetPage";

			var extras = new string[] {
				"Extra One",
				"Extra Two",
				"Extra Three",
				"Extra Four",
				"Extra Five",
				"Extra Six",
				"Extra Seven",
				"Extra Eight",
				"Extra Nine",
				"Extra Ten",
				"Extra Eleven",
			};

			Content = new ScrollView {
				Content = new StackLayout {
					Spacing = 0,
					Children = {
						MakeActionSheetButton (this, "ActionSheet Cancel", null, "Cancel", null),
						MakeActionSheetButton (this, "ActionSheet Cancel Extras", null, "Cancel", null, extras),
						MakeActionSheetButton (this, "ActionSheet Cancel Destruction", null, "Cancel", "Destruction"),
						MakeActionSheetButton (this, "ActionSheet Cancel Destruction Extras", null, "Cancel", "Destruction", extras),
						MakeActionSheetButton (this, "ActionSheet Destruction", null, null, "Destruction"),
						MakeActionSheetButton (this, "ActionSheet Destruction Extras", null, null, "Destruction", extras),
						MakeActionSheetButton (this, "ActionSheet Extras", null, null, null, extras),
						MakeActionSheetButton (this, "ActionSheet Title", "Title", null, null),
						MakeActionSheetButton (this, "ActionSheet Title Cancel", "Title", "Cancel", null),
						MakeActionSheetButton (this, "ActionSheet Title Cancel Extras", "Title", "Cancel", null, extras),
						MakeActionSheetButton (this, "ActionSheet Title Cancel Destruction", "Title", "Cancel", "Destruction"),
						MakeActionSheetButton (this, "ActionSheet Title Cancel Destruction Extras", "Title", "Cancel", "Destruction", extras),
						MakeActionSheetButton (this, "ActionSheet Title Destruction", "Title", null, "Destruction"),
						MakeActionSheetButton (this, "ActionSheet Title Destruction Extras", "Title", null, "Destruction", extras),
						MakeActionSheetButton (this, "ActionSheet Title Extras", "Title", null, null, extras),
					}
				}
			};
		}

		static Button MakeActionSheetButton (Page page, string buttonText, string title, string cancel, string destruction, params string[] extras)
		{
			var actionSheetButton = new Button {
				Text = buttonText
			};

			actionSheetButton.Clicked += async (sender, e) => await page.DisplayActionSheet (title, cancel, destruction, extras);
				
			return actionSheetButton;
		}
	}
}