2017-03-20 22:09:41 +03:00
|
|
|
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"
|
|
|
|
};
|
|
|
|
|
2017-05-10 20:20:57 +03:00
|
|
|
username.SetValue(AutomationProperties.LabeledByProperty, instructions1);
|
2017-03-20 22:09:41 +03:00
|
|
|
|
|
|
|
var password = new Entry
|
|
|
|
{
|
|
|
|
Placeholder = "Password",
|
|
|
|
IsPassword = true
|
|
|
|
};
|
|
|
|
|
2017-05-10 20:20:57 +03:00
|
|
|
password.SetValue(AutomationProperties.LabeledByProperty, instructions2);
|
2017-03-20 22:09:41 +03:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|