Dela via


PasswordBox.InputScope Property

Definition

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

public:
 property InputScope ^ InputScope { InputScope ^ get(); void set(InputScope ^ value); };
InputScope InputScope();

void InputScope(InputScope value);
public InputScope InputScope { get; set; }
var inputScope = passwordBox.inputScope;
passwordBox.inputScope = inputScope;
Public Property InputScope As InputScope
<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

See also