summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/GalleryPages/PickerGallery.cs
blob: 676c907a21289da26dd7d490f3d443293834965f (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xamarin.Forms.Controls
{
	public class PickerGallery : ContentPage
	{
		public PickerGallery ()
		{
			var picker = new Picker {Title="Dismiss in one sec", Items =  {"John", "Paul", "George", "Ringo"}};
			picker.Focused += async (object sender, FocusEventArgs e) => {
				await Task.Delay (1000);
				picker.Unfocus ();
			};

			Label testLabel = new Label { Text = "", AutomationId="test", ClassId="test" };

			Picker p1 = new Picker { Title = "Pick a number", Items = { "0", "1", "2", "3", "4", "5", "6" }};
			p1.SelectedIndexChanged += (sender, e) => {
				testLabel.Text = "Selected Index Changed";
			};

			Content = new ScrollView { 
				Content = new StackLayout {
					Padding = new Thickness (20, 20),
					Children = {
						new DatePicker (),
						new TimePicker (),
						new DatePicker { Format = "D" },
						new TimePicker { Format = "T" },
						new Picker {Title = "Set your favorite Beatle", Items =  {"John", "Paul", "George", "Ringo"}},
						new Picker {Title = "Set your favorite Stone", Items = {"Mick", "Keith", "Charlie", "Ronnie"}, SelectedIndex = 1},
						new Picker {Title = "Pick", Items =  {"Jason Smith", "Rui Marinho", "Eric Maupin", "Chris King"}, HorizontalOptions = LayoutOptions.CenterAndExpand},
						picker,
						testLabel,
						p1
					}
				}
			};
		}
	}
}