The Hardware Keyboard
Although you probably have a Windows phone for testing your apps, you may very well not have a model with a hardware keyboard. Don't worry—as long as you support both orientations for any page involving typing, your app should work just fine on such a device without further testing. Still, it is helpful to understand how the hardware keyboard works.
A Windows phone can have a hardware keyboard in a number of different configurations. It could slide out, flip out, swivel out, or just be stationary. It could be placed anywhere, and be oriented for either portrait, landscape left, or landscape right.
When a non-stationary keyboard is tucked away, the phone acts as if there is no hardware keyboard, and the on-screen keyboard behaves as it always does. When a non-stationary hardware keyboard is pulled/flipped/swiveled out, the screen's orientation automatically changes to match the orientation of the keyboard (if the current page is marked as supporting this orientation). This happens regardless of the phone's physical orientation, so it may temporarily produce a sideways screen. However, the user will presumably rotate the phone appropriately before using the keyboard.
When the hardware keyboard is activated, the on-screen keyboard goes away (if it was visible at the time) and stays away, except for a few special circumstances. Pressing the symbol (SYM) key on the hardware keyboard invokes the on-screen keyboard with pages of numbers and symbols. Pressing the emoticons key on the hardware keyboard invokes the on-screen keyboard with pages of emoticons. Pressing the accent key after typing certain letters automatically cycles through the accented variations, but it also shows the accented variations as on-screen keyboard buttons. Text suggestions, when used by the current input scope, also appear on the screen. And so on. The last two circumstances are demonstrated in Figure 3.3 inside the built-in Alarms app.
Figure 3.3 Two examples of small on-screen supplements for an activated hardware keyboard, displayed at the edge of the screen adjacent to the keyboard.
The most important thing to understand about the hardware keyboard is what it is and isn't intended for. It is meant to provide an alternate way to type text into a text box. And that is it. It should never be used for any kind of navigation (scrolling, panning, changing control focus)—even for a game. Although it may have arrow keys for moving the caret within a text box, those arrows should be used for any other purpose. The hardware number keys can't even be used with the built-in Calculator app, because that is not the same thing as typing into a text box!
Although these restrictions make the hardware keyboard less compelling than it could have been, it frees developers from having to worry about exploiting such optional features. It also protects users from the existence of apps that only work well with a hardware keyboard. Windows Phone and its apps are clearly optimized for touch screen usage, and users without a hardware keyboard should not feel like they are missing out on anything other than arguably easier typing.