Share via


PasswordBox.InputScope Property

Definition

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

public InputScope InputScope { get; set; }
<PasswordBox>
  <PasswordBox.InputScope>
    <InputScope>
      <InputScope.Names>
        <InputScopeName NameValue="inputScopeName"/>
      </InputScope.Names>
    </InputScope>
  </PasswordBox.InputScope>
</PasswordBox>

Property Value

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

Examples

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

<PasswordBox x:Name="pinBox" Header="Enter PIN">
    <PasswordBox.InputScope>
        <InputScope>
            <InputScope.Names>
                <InputScopeName NameValue="NumericPin"/>
            </InputScope.Names>
        </InputScope>
    </PasswordBox.InputScope>
</PasswordBox>
PasswordBox passwordBox = new PasswordBox();
passwordBox.Header = "Enter password";

InputScope scope = new InputScope();
InputScopeName scopeName = new InputScopeName();
scopeName.NameValue = InputScopeNameValue.Password;
scope.Names.Add(scopeName);
passwordBox.InputScope = scope;

Remarks

The InputScope property on PasswordBox supports only the Password and NumericPin values. Any other value is ignored.

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 soft keyboard might show a number pad for text input when the control has its InputScope set to NumericPin.

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.

Applies to

Product Versions
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100

See also