一起學Windows Phone7開發(十三.三 輸入控制項)

來源:互聯網
上載者:User

     在Phone7中主要的輸入控制項其實就有兩個,一個是textbox,另一個就是password控制項。這兩個控制項中尤其是TextBox控制項有了很多新特性。

一.PasswordBox:   密碼框控制項,用於輸入自訂的遮罩字元的輸入控制項。

<PasswordBox Grid.Row="1" Height="72" HorizontalAlignment="Left" Margin="12,284,0,0" Name="passwordBox1" VerticalAlignment="Top" Width="460" PasswordChar="$" />

<PasswordBox Grid.Row="1" Height="72" HorizontalAlignment="Left" Margin="12,119,0,0"    Name="passwordBox2" VerticalAlignment="Top" Width="460" />

<PasswordBox Grid.Row="1" Height="72" HorizontalAlignment="Left" Margin="12,454,0,0" Name="passwordBox3" VerticalAlignment="Top" Width="460"  PasswordChar="@"/>

PasswordChar:設定密碼顯示字元。

二.TextBox:  輸入框控制項。

<TextBox Height="72" HorizontalAlignment="Left" Margin="11,42,0,0" Name="textBox1"  VerticalAlignment="Top" Width="460"  SelectionBackground="Red" SelectionForeground="Green" InputScope="Text"/>

Text:設定或擷取所要輸入的文字。

IsReadOnly:設定是否允許輸入。

SelectionBackground:設定輸入框中選中文字的背景色。

SelectionForground:設定輸入框中選中文字的字色。

SelectedText:擷取輸入框中被選中的文字。可以用在SelectionChanged事件中。

InputScope:可以讓軟鍵盤產生不同的鍵面效果,以利於輸入。

也可以這樣設定:

<TextBox.InputScope>

                    <InputScope>

                        <InputScopeName NameValue="Text"></InputScopeName>

                    </InputScope>

                </TextBox.InputScope>

 

以下是這個屬性支援的Scope列表:

1.     AddressCity
2. AddressCountryName
3. AddressCountryShortName
4. AddressStateOrProvince
5. AddressStreet
6. AlphanumericFullWidth
7. AlphanumericHalfWidth
8. ApplicationEnd
9. Bopomofo
10. Chat
11. CurrencyAmount
12. CurrencyAmountAndSymbol
13. CurrencyChinese
14. Date
15. DateDay
16. DateDayName
17. DateMonth
18. DateMonthName
19. DateYear
20. Default
21. Digits
22. EmailNameOrAddress
23. EmailSmtpAddress
24. EmailUserName
25. EnumString
26. FileName
27. FullFilePath
28. Hanja
29. Hiragana
30. KatakanaFullWidth
31. KatakanaHalfWidth
32. LogOnName
33. Maps
34. NameOrPhoneNumber
35. Number
36. NumberFullWidth
37. OneChar
38. Password
39. PersonalFullName
40. PersonalGivenName
41. PersonalMiddleName
42. PersonalNamePrefix
43. PersonalNameSuffix
44. PersonalSurname
45. PhraseList
46. PostalAddress
47. PostalCode
48. Private
49. RegularExpression
50. Search
51. Srgs
52. TelephoneAreaCode
53. TelephoneCountryCode
54. TelephoneLocalNumber
55. TelephoneNumber
56. Text
57. Time
58. TimeHour
59. TimeMinorSec
60. Url
61. Xml
62. Yomi

可以通過代碼來擷取上面的列表:

FieldInfo[] array = typeof(InputScopeNameValue).GetFields(BindingFlags.Public | BindingFlags.Static);

 

Text:軟鍵盤增加了Word Flow

 

TelephoneNumber:鍵面全部為數字顯示。

 

Url: 鍵面顯示.com。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.