This question is locked. New answers and comments are not allowed.
Hi
I am working on a WP8 project
I am using passwordbox and I want number keyboard appear.
I tried inputScope like in the textbox but there is no property named InputScope.
is there any way?
thanks.
I am working on a WP8 project
I am using passwordbox and I want number keyboard appear.
I tried inputScope like in the textbox but there is no property named InputScope.
is there any way?
thanks.
4 Answers, 1 is accepted
0
Hello,
Thank you for your question.
This is not possible. The InputScope is available only for the TextBox (and RadTextBox respectively). Neither RadPasswordBox, nor the native PasswordBox has this option and the framework doesn't provide a way to manipulate the layout (and the type) of the keyboard that is used.
Regards,
Todor
Telerik
Thank you for your question.
This is not possible. The InputScope is available only for the TextBox (and RadTextBox respectively). Neither RadPasswordBox, nor the native PasswordBox has this option and the framework doesn't provide a way to manipulate the layout (and the type) of the keyboard that is used.
Regards,
Todor
Telerik
Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.
0
Eugeniy
Top achievements
Rank 2
answered on 01 Oct 2014, 06:32 AM
This is an example how to set InputScope to Number. Add property and a bit more logic if you want to set any input scope you want:
01.public class NumericPasswordBox : RadPasswordBox02. {03. private TextBox _passwordTextBox;04. 05. public override void OnApplyTemplate()06. {07. base.OnApplyTemplate();08. 09. _passwordTextBox = GetTemplatePart<TextBox>("PART_PasswordTextBox");10. 11. var inputScope = new InputScope();12. inputScope.Names.Add(new InputScopeName13. {14. NameValue = InputScopeNameValue.Number15. });16. _passwordTextBox.InputScope = inputScope;17. }18. 19. protected override void OnGotFocus(RoutedEventArgs e)20. {21. base.OnGotFocus(e);22. _passwordTextBox.Focus23. }24. }0
Eugeniy
Top achievements
Rank 2
answered on 01 Oct 2014, 06:33 AM
sorry, _passwordTextBox.Focus(); - at the end
0
Eugeniy
Top achievements
Rank 2
answered on 10 Oct 2014, 01:08 PM
Here is a little bit different solution:
public class NumericPasswordBox : RadPasswordBox{ public NumericPasswordBox() { PeekButtonVisibility=Visibility.Collapsed; } private TextBox _passwordTextBox; private PasswordBox _passwordBox; public override void OnApplyTemplate() { base.OnApplyTemplate(); _passwordTextBox = GetTemplatePart<TextBox>("PART_PasswordTextBox"); _passwordBox = GetTemplatePart<PasswordBox>("PART_PasswordBox"); _passwordBox.IsHitTestVisible = false; var inputScope = new InputScope(); inputScope.Names.Add(new InputScopeName { NameValue = InputScopeNameValue.Number }); _passwordTextBox.InputScope = inputScope; } protected override void OnGotFocus(RoutedEventArgs e) { base.OnGotFocus(e); _passwordTextBox.Focus(); _passwordTextBox.Opacity = 1; _passwordBox.Opacity = 0; } protected override void OnLostFocus(RoutedEventArgs e) { base.OnLostFocus(e); _passwordTextBox.Opacity = 0; _passwordBox.Opacity = 1; }}