TextBox.InputScope property

Gets or sets the context for input used by this TextBox.

Syntax


public InputScope InputScope { get; set; }


<TextBox InputScope="inputScopeName" .../>

XAML Values

inputScopeName

A named constant of the InputScopeNameValue enumeration, such as Number.

Property value

Type: InputScope

The input scope, which provides a hint at the type of text input expected by the control.

Remarks

The input scope provides a hint at the type of text input expected by the control. Various elements of the system can respond to the hint provided by the input scope and provide a specialized UI for the input type. For example, the touch keyboard might show a number pad for text input when the control has its InputScope set to Number.

The control might also interpret the data being entered differently (typically for East Asian related input scopes). The input scope does not perform any validation, and does not prevent the user from providing any input through a hardware keyboard or other input device.

Other properties that affect the touch keyboard are IsSpellCheckEnabled, IsTextPredictionEnabled, and PreventKeyboardDisplayOnProgrammaticFocus. For more info and examples, see How to use input scope to change the touch keyboard.

Examples

Here's how to set the InputScope in XAML and in code.


<TextBox Header="Telephone Number" InputScope="TelephoneNumber"/>



TextBox phoneNumberTextBox = new TextBox();
phoneNumberTextBox.Header="Telephone Number";

InputScope scope = new InputScope();
InputScopeName scopeName = new InputScopeName();
scopeName.NameValue = InputScopeNameValue.TelephoneNumber;
scope.Names.Add(scopeName);
phoneNumberTextBox.InputScope = scope;

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

TextBox
IsSpellCheckEnabled
IsTextPredictionEnabled
How to use input scope to change the touch keyboard

 

 

Show:
© 2015 Microsoft