SurfaceTextBox Class

Represents a control that implements a text field that users can edit.

Namespace: Microsoft.Surface.Presentation.Controls
Assembly: Microsoft.Surface.Presentation (in Microsoft.Surface.Presentation)


public class SurfaceTextBox : TextBox
public class SurfaceTextBox extends TextBox
public class SurfaceTextBox extends TextBox

The behavior of a SurfaceTextBox control is similar to that of a TextBox control. The main difference is that the SurfaceTextBox control includes touch-event handlers as well as mouse-event handlers and stylus-event handlers. The touch-event handlers are applicable to both devices made for Microsoft Surface and Windows Touch computers.

A SurfaceTextBox control enables a user to enter text by using an on-screen keyboard. If your application is running on devices made for Surface, the Surface on-screen keyboard is used if the Surface Shell is running. Otherwise, the Tablet virtual keyboard is used.

Surface Shell is part of the installation package that comes with devices made for Surface. Surface Shell is not available with the SDK installation package or the Surface runtime.

Use the properties of the SurfaceEnvironment class to determine if your application is running in Surface Shell on a device made for Surface.

When a SurfaceTextBox control is activated, it automatically displays and positions the on-screen keyboard.

On a device made for Surface, your application can control the positioning of the SurfaceKeyboard object by handling the KeyboardPositioning event. SurfaceKeyboard supports two layouts: an alphanumeric layout and a numeric-only layout. You can select which layout the SurfaceKeyboard object uses by setting the KeyboardLayout property.

When a user dismisses (hides) the on-screen keyboard object, the associated SurfaceTextBox control is automatically deactivated.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.



Operating System (OS)Windows 7
Software Developer Kit (SDK)Surface 2.0
.NET Framework 4
Developer environmentVisual Studio 2010, Express or full edition
Microsoft Expression Blend 4.0 (optional)
End-user hardwareDevices made for Surface 2.0, or
Windows Touch computers

Did you find this information useful? Please send us your suggestions and comments.

© Microsoft Corporation. All rights reserved.