We recently had a customer let us know that the difference between keyboard navigation on PocketPC and Smartphone was causing them trouble. I thought I would take little time to work up a workaround for this issue. I'll present a solution using the recommended managed methods first and then an alternative which plays with native interop to the SendInput() API.
The basic problem is that the direction pad (d-pad) can be used to navigate through a form of controls on Smartphone but not on PocketPC. The d-pad on both devices act like the arrow keys of a standard keyboard and sends VK_UP, VK_DOWN, VK_LEFT and VK_RIGHT inputs to the system when used. ComboBox, DateTimePicker and TextBox are examples of controls which capture and respond to the up and down arrows on PocketPC (Tab and Shift-Tab still navigate as expected and stylus input to the touchscreen, if present, will switch focus between controls).
The recommended solution is to hook the KeyDown event (or override OnKeyDown) to capture Keys.Down and Keys.Up and use the SelectNextControl() method on the Control class (which calls the same code as the internal tabbing navigation) to navigate to the next/previous control in the tab order.
Here's an excerpt from SmartphoneStyleNavigationWithSNC.zip which contains an instance of each of the troublesome controls, ComboBox, DateTimePicker and TextBox:
// Custom code in SampleForm.cs
Something to note above is that we can call SelectNextControl() directly because HandleKeyDown() is implemented on a form, a top level window. If you decide to create custom control classes from ComboBox, DateTimePicker and/or TextBox which override OnKeyDown, you will need to use the following code:
this.TopLevelControl.SelectNextControl((Control)sender, e.KeyData == Keys.Down, true, true, true);
Just for kicks I looked into eating the arrow key messages and putting [Shift-]Tab key messages into the message queue. There's an official API, SendInput(), to do this. Here are the relevant parts of that code (note that you still need to hook the KeyDown events of the controls in question to HandleKeyDown):
This posting is provided "AS IS" with no warranties, and confers no rights.