blob: 331e5269517e23c9ec45ce617a919a1d9749b696 (
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
|
using System;
using Windows.UI.Xaml.Input;
#if WINDOWS_UWP
namespace Xamarin.Forms.Platform.UWP
#else
namespace Xamarin.Forms.Platform.WinRT
#endif
{
public static class KeyboardExtensions
{
public static InputScope ToInputScope(this Keyboard self)
{
if (self == null)
throw new ArgumentNullException("self");
var result = new InputScope();
var name = new InputScopeName();
if (self == Keyboard.Default)
{
name.NameValue = InputScopeNameValue.Default;
}
else if (self == Keyboard.Chat)
{
name.NameValue = InputScopeNameValue.Chat;
}
else if (self == Keyboard.Email)
{
name.NameValue = InputScopeNameValue.EmailSmtpAddress;
}
else if (self == Keyboard.Numeric)
{
name.NameValue = InputScopeNameValue.Number;
}
else if (self == Keyboard.Telephone)
{
name.NameValue = InputScopeNameValue.TelephoneNumber;
}
else if (self == Keyboard.Text)
{
name.NameValue = InputScopeNameValue.Default;
}
else if (self == Keyboard.Url)
{
name.NameValue = InputScopeNameValue.Url;
}
else
{
name.NameValue = InputScopeNameValue.Default;
}
result.Names.Add(name);
return result;
}
}
}
|