Categories
Uncategorized

Windows Phone 7 – Input

The Software Input Panel in Windows Phone 7 is entirely new. Unlike previous versions there will be a single SIP provider and device manufacturers will not be able to customise it. This means you can guarantee the same experience across different device types. With Windows Mobile there were some big differences between the input models of Standard Edition (Smartphone) and Professional Edition (Pocket PC) device types. We had the ability on Professional Edition devices to show or hide the sip and select from available input panels but no further control to customise the panel based on the input type required. For example to get a numerical keypad often required faking a screen press to “shift” the keyboard (unless your device had a specific keypad input panel).

Windows Phone 7 has a standard input panel but it does support different input contexts and will adjust accordingly. So if you mark a TextBox as requiring a Phone Number you’ll get a big numerical keypad. There are a number of different contexts supported, the UI guidelines document describes them but has some errors as the names do not match those you’ll see in Visual Studio and there are no examples of how to set them. I’ve tested a number of different InputScopeName values and have listed those below with a description of their behaviour (this effectively replaces the table on page 20 of the UI guidelines).

InputScopeName Layout
Default QWERTY
Text QWERTY with emoticons
EmailNameOrAddress QWERTY with .com and @ keys
TelephoneNumber 12-key phone pad
Url QWERTY with .com and “Go” enter key
Maps Not present
Search Same as Url – note this is not semi-transparent
SMS Address Not present – use TelephoneNumber

 

Along with these contexts there are others defined, most of which are the same or variations of the above. For example there are a number of numerical inputs such as CurrencyWithSymbol which has the QWERTY keyboard shifted to show numerals with common currency symbols (Dollar, Pound, Euro and Yen). All the ones I tried worked except for Xml which threw an unhandled exception. You can set the context easily in your XAML:-

Code Snippet
  1. <TextBox Height="31" HorizontalAlignment="Left" Margin="16,173,0,0" Name="textBox1" Text="TextBox" VerticalAlignment="Top" Width="449">
  2.     <TextBox.InputScope>
  3.         <InputScope>
  4.             <InputScope.Names>
  5.                                        <InputScopeName NameValue="EmailNameOrAddress"/>
  6.             </InputScope.Names>
  7.         </InputScope>
  8.     </TextBox.InputScope>
  9. </TextBox>

By Peter Foot

Microsoft Windows Development MVP

One reply on “Windows Phone 7 – Input”

Great!

But why is the names property of type IList? So one can set more than one InputScope? But how to switch between them?

Better question: How to run your own InputScopeName?

Regards

MikeH

Comments are closed.