Windows.UI.Xaml.Controls.PasswordBox.InputScope
February 14, 2023 ยท View on GitHub
-description
Gets or sets the context for input used by this PasswordBox.
-xaml-syntax
<PasswordBox>
<PasswordBox.InputScope>
<InputScope>
<InputScope.Names>
<InputScopeName NameValue="inputScopeName"/>
</InputScope.Names>
</InputScope>
</PasswordBox.InputScope>
</PasswordBox>
-xaml-values
- inputScopeName
- A string that matches one of the named constants of the [InputScopeNameValue](../windows.ui.xaml.input/inputscopenamevalue.md) enumeration, such as NumericPin.
-property-value
The input scope, which provides a hint at the type of text input expected by the control. The default is null.
-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.
-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;