文章目錄
- 使用預設鍵盤
- 進入一個頁面,自動彈出鍵盤
- 聊天用鍵盤
- Url
- Email
- Name or Phone Number
- PostalAddress
- PhoneNumber
鍵盤操作
鍵盤操作很簡單,直接代碼
使用預設鍵盤
InputScope scope = new InputScope();
InputScopeName name = new InputScopeName();
name.NameValue = InputScopeNameValue.Default; //<--Here
scope.Names.Add(name);
txtK1.InputScope = scope;
進入一個頁面,自動彈出鍵盤
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
//This code opens up the keyboard when you navigate to the page.
txtK1.UpdateLayout();
txtK1.Focus();
}
聊天用鍵盤
含有一個smiley = smily 微笑表情
//You can set the Keyboard Input Scope by using either XAML or code.
//See the XAML file for the XAML version.
//The code version is below.
InputScope scope = new InputScope();
InputScopeName name = new InputScopeName();
name.NameValue = InputScopeNameValue.Chat; //<--Here
scope.Names.Add(name);
txtK2.InputScope = scope;
//To create keyboard 2, you can use any of the following Input Scopes.
//--------------------------------------------------------------------
// Chat
// Text
Url
含有。Com
InputScope scope = new InputScope();
InputScopeName name = new InputScopeName();
name.NameValue = InputScopeNameValue.Url; //<--Here
scope.Names.Add(name);
txtK3.InputScope = scope;
Email
含有。com和@表徵圖
//You can set the Keyboard Input Scope by using either XAML or code.
//See the XAML file for the XAML version.
//The code version is below.
InputScope scope = new InputScope();
InputScopeName name = new InputScopeName();
name.NameValue = InputScopeNameValue.EmailNameOrAddress; //<--Here
scope.Names.Add(name);
txtK4.InputScope = scope;
//To create keyboard 4, you can use any of the following Input Scopes.
//--------------------------------------------------------------------
// EmailNameOrAddress
// EmailSmtpAddress
// EmailUserName
Name or Phone Number
就是直接顯示數字鍵台(含有 123 表徵圖 點擊 會開啟數字鍵台)
InputScope scope = new InputScope();
InputScopeName name = new InputScopeName();
name.NameValue = InputScopeNameValue.NameOrPhoneNumber; //<--Here
scope.Names.Add(name);
txtK5.InputScope = scope;
//To create keyboard 5, you can use any of the following Input Scopes.
//--------------------------------------------------------------------
// NameOrPhoneNumber
PostalAddress
和上面的區別是 (顯示&123表徵圖,點擊後不光顯示數字還有一些常用標點符號)
InputScope scope = new InputScope();
InputScopeName name = new InputScopeName();
name.NameValue = InputScopeNameValue.PostalAddress; //<--Here
scope.Names.Add(name);
txtK6.InputScope = scope;
//To create keyboard 6, you can use any of the following Input Scopes.
//--------------------------------------------------------------------
// AddressStreet
// CurrencyAmountAndSymbol
// CurrencyChinese
// PostalAddress
// PostalCode
// Time
PhoneNumber
顯示數字鍵台
InputScope scope = new InputScope();
InputScopeName name = new InputScopeName();
name.NameValue = InputScopeNameValue.TelephoneNumber; //<--Here
scope.Names.Add(name);
txtK7.InputScope = scope;
//To create keyboard 7, you can use any of the following Input Scopes.
//--------------------------------------------------------------------
// TelephoneAreaCode
// TelephoneCountryCode
// TelephoneLocalNumber
// TelephoneNumber