Adding NumericPassword component to your Windows Phone project is easy, as it takes only 5 simple steps:
- Add ExternalGoods.NumericPassword.WP package to your project via NuGet Package manager.
In Visual Studio choose Tools > NuGet Package Manager > Manage NuGet Packages for Solution..., search for NumericPassword in upper right corner of the dialog and click Install. - Add namespace reference to your PhoneApplicationPage.
You can choose any prefix that does not exist on your page yet (red part), but the value (blue part) must stay the same, saying VS what assembly and namespace to look for the component. - Add NumericPassword component to your XAML layout using namespace from the previous step.
- Set a password character you wish to use via PasswordChar property. If not set the default character
("*")("●") will be used. - You can set any other common property or event, just like you would do with classic TextBox.
The only one protected property (which you can read, but can not set) is InputScope, which is hardcoded to Number.
In code you can access the value directly the same way like in the classic TextBox:
pinPopup_pin.Text = "0000"; //presets the value (user will see four dots instead)
string value = pinPopup_pin.Text; //returns value entered by user (e.g. 1234)
string value = pinPopup_pin.Text; //returns value entered by user (e.g. 1234)
type | name | meaning | default value | since |
---|---|---|---|---|
string | PasswordChar | character to be displayed instead of each one digit of the numeric password | ● | 1.0.0 |
bool | PasswordVisible | when set to true, the password is displayed in a plain form (i.e. showing original digits instead of PasswordChar) | false | 1.0.2 |
string | Text | current password value; when being set, the digits are displayed as PasswordChars, when read the original plain-text password is returned | {empty string} | 1.0.0 |
Hi. Thanks for coming up with this. But unfortunately it's not available on Windows Mobile 10 though.
ReplyDeleteHi Alex, thank you for letting me know. The library is built for WP8, so it would make sense. I will try my best to create a Wp10 build ASAP.
DeleteUsing it in Wp8 application on Wp10 device should work.
This comment has been removed by the author.
DeleteThis comment has been removed by the author.
DeleteHi. Thanks for coming up with this. But unfortunately it's not available on Windows Mobile 10 though.
ReplyDeleteHi thanks for the reply. Anyway, just to let you know that apparently Windows 10 came with their own built in textbox by using InputScope="NumericPin". Hopefully this would enlighten your other readers.
ReplyDeleteMore details https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.input.inputscopenamevalue.aspx