WP7 对于在输入的时候可以设置文本框的输入作用域。也就是说,在对于文本输入的时可以设置不能的键盘。比如:设置数字时,只调用数字键盘出来,电子邮件也如此。由于目前在对文本框设置作用域时,没有智能提示,只能查询API了,可能这是WP7 这个版本的问题了。 1、只能对数据输入时用 TextBlock Text =your number Style =
WP7 对于在输入的时候可以设置文本框的输入作用域。也就是说,在对于文本输入的时可以设置不能的键盘。比如:设置数字时,只调用数字键盘出来,电子邮件也如此。由于目前在对文本框设置作用域时,没有智能提示,只能查询API了,可能这是WP7 这个版本的问题了。
1、只能对数据输入时用
<TextBlock Text="your
number" Style="{StaticResourcePhoneTextLargeStyle}"
/>
<TextBox InputScope="Number" Name="txtNumber"Height="71"Width="460"
/>
2、输入个人名称及信息
<TextBlock Text="your
name" Style="{StaticResource PhoneTextLargeStyle}"
/>
<TextBox InputScope="PersonalFullName" Name="txtName" Height="71" Width="460"
/>
3、输入地址信息
<TextBlock Text="what
country are you from?" Style="{StaticResourcePhoneTextLargeStyle}"
/>
<TextBox InputScope="AddressCountryName"Name="txtCountry"Height="71"Width="460"
/>
4、电子邮件
<TextBlock Text="your
email" Style="{StaticResource PhoneTextLargeStyle}"
/>
<TextBox InputScope="EmailNameOrAddress" Name="txtEmail" Height="71" Width="460"
/>
5、URL
<TextBlockText="your
favorite website" Style="{StaticResourcePhoneTextLargeStyle}"
/>
<TextBox InputScope="Url" Name="txtWebsite"Height="71"Width="460"
/>
6、电话号码
<TextBlockText="call
your best friend" Style="{StaticResourcePhoneTextLargeStyle}"
/>
<TextBox InputScope="TelephoneNumber" Name="txtFriend"Height="71"Width="460"
/>
其归纳起来就六个枚举型
枚举值 |
说明 |
Number | 调用输入数字键盘 |
PersonalFullName | 调用字母键盘 |
AddressCountryName | 调用字母键盘 |
EmailNameOrAddress | 调用有@,.COM的键盘 |
Url | 调用有www,http.键盘 |
TelephoneNumber | 调用数字键盘 |
本文来自曹代明的博客,原文地址:http://www.cnblogs.com/caodaiming/archive/2011/05/04/2037063.html