summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/CoreGalleryPages/KeyboardCoreGalleryPage.cs
blob: 551100459739f568e50f476a79ab5bb6635a9b2b (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
using System;
using System.Collections.Generic;

using Xamarin.Forms.CustomAttributes;

namespace Xamarin.Forms.Controls
{
	internal class KeyboardCoreGallery : ContentPage
	{
		public KeyboardCoreGallery ()
		{
			var keyboardTypes = new[] {
				Keyboard.Chat,
				Keyboard.Default,
				Keyboard.Email,
				Keyboard.Numeric,
				Keyboard.Plain,
				Keyboard.Telephone,
				Keyboard.Text,
				Keyboard.Url
			};

			var layout = new StackLayout ();

			foreach (var keyboardType in keyboardTypes) {
				var viewContainer = new ViewContainer<Entry> (Test.Entry.Keyboard, new Entry { Placeholder = keyboardType.ToString (), Keyboard = keyboardType } );
				layout.Children.Add (viewContainer.ContainerLayout);
			}

			var customKeyboards = new [] {
				Tuple.Create ("None", Keyboard.Create (KeyboardFlags.None)),
				Tuple.Create ("Suggestions", Keyboard.Create (KeyboardFlags.Suggestions)),
				Tuple.Create ("Spellcheck", Keyboard.Create (KeyboardFlags.Spellcheck)),
				Tuple.Create ("SpellcheckSuggestions", Keyboard.Create (KeyboardFlags.Spellcheck | KeyboardFlags.Suggestions)),
				Tuple.Create ("Capitalize", Keyboard.Create (KeyboardFlags.CapitalizeSentence)),
				Tuple.Create ("CapitalizeSuggestions", Keyboard.Create (KeyboardFlags.CapitalizeSentence | KeyboardFlags.Suggestions)),
				Tuple.Create ("CapitalizeSpellcheck", Keyboard.Create (KeyboardFlags.CapitalizeSentence | KeyboardFlags.Spellcheck)),
				Tuple.Create ("CapitalizeSpellcheckSuggestions",  Keyboard.Create (KeyboardFlags.CapitalizeSentence | KeyboardFlags.Spellcheck | KeyboardFlags.Suggestions)),
				Tuple.Create ("All",  Keyboard.Create (KeyboardFlags.All)),
			};

			foreach (var customKeyboard in customKeyboards) {
				var viewContainer = new ViewContainer<Entry> (Test.Entry.Keyboard, new Entry { Placeholder = customKeyboard.Item1, Keyboard = customKeyboard.Item2 } );
				layout.Children.Add (viewContainer.ContainerLayout);
			}

			Content = new ScrollView { Content = layout };
		}
		
	}
}