public static void Open(UIElement focused_) { string text = ""; TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default; bool multiline = false; bool secure = false; int characterLimit = 0; if (focused_ is FrameworkElement) { switch (((FrameworkElement)focused_).InputScope) { case InputScope.Url: keyboardType = TouchScreenKeyboardType.URL; break; case InputScope.Digits: case InputScope.Number: case InputScope.NumberFullWidth: keyboardType = TouchScreenKeyboardType.NumbersAndPunctuation; break; case InputScope.TelephoneNumber: case InputScope.TelephoneLocalNumber: keyboardType = TouchScreenKeyboardType.PhonePad; break; case InputScope.AlphanumericFullWidth: case InputScope.AlphanumericHalfWidth: keyboardType = TouchScreenKeyboardType.NamePhonePad; break; case InputScope.EmailSmtpAddress: keyboardType = TouchScreenKeyboardType.EmailAddress; break; case InputScope.RegularExpression: keyboardType = TouchScreenKeyboardType.Search; break; default: keyboardType = TouchScreenKeyboardType.Default; break; } } TextBox textBox = focused_ as TextBox; PasswordBox passwordBox = focused_ as PasswordBox; if (textBox != null) { text = textBox.Text; multiline = textBox.TextWrapping == TextWrapping.Wrap && textBox.AcceptsReturn; characterLimit = textBox.MaxLength; textBox.HideCaret(); } else if (passwordBox != null) { text = passwordBox.Password; secure = true; passwordBox.HideCaret(); } #if UNITY_2018_1_OR_NEWER keyboard = TouchScreenKeyboard.Open(text, keyboardType, true, multiline, secure, false, "", characterLimit); #else keyboard = TouchScreenKeyboard.Open(text, keyboardType, true, multiline, secure, false, ""); #endif focused = focused_; undoString = text; }