summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla45067.cs
blob: b0a7dd2ffb2321c200f3946e3fa46f0baf17a405 (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
65
66
67
68
69
70
71
72
73
74
75
76
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls.Issues
{
	[Preserve(AllMembers = true)]
	[Issue(IssueTracker.Bugzilla, 45067, "[UWP] No way of cleanly dismissing soft keyboard", PlatformAffected.WinRT)]
	public class Bugzilla45067 : TestContentPage
	{
		protected override void Init()
		{
			var button = new Button { Text = "Start" };

			button.Clicked += (sender, args) =>
			{
				SwitchMainPage();
			};

			Content = button;
		}

		void SwitchMainPage()
		{
			Application.Current.MainPage = new _45067Content();
		}

		class _45067Content : TestContentPage
		{
			protected override void Init()
			{
				var instructions1 = new Label { Text = "Enter text in the 'Username' Entry, then hit 'Enter/Return' on the soft keyboard. The keyboard should be dismissed." };

				var instructions2 = new Label { Text = "Enter text in the 'Password' Entry, then hit 'Enter/Return' on the soft keyboard. The keyboard should be dismissed." };

				var username = new Entry
				{
					Placeholder = "Username"
				};

				username.SetValue(AutomationProperties.LabeledByProperty, instructions1);

				var password = new Entry
				{
					Placeholder = "Password",
					IsPassword = true
				};

				password.SetValue(AutomationProperties.LabeledByProperty, instructions2);

				var button = new Button { Text = "Submit", IsEnabled = false };

				username.Completed += (s, e) =>
				{
					button.Focus();
				};

				password.Completed += (s, e) =>
				{
					button.Focus();
				};

				Content = new StackLayout
				{
					Children =
					{
						instructions1,
						username,
						instructions2,
						password,
						button
					}
				};
			}
		}
	}
}