How would I go about overlaying the gray word 'password' on top of a password box?
-
31-05-2021 - |
質問
You know how in many WP7 apps you can 'watermark' a textbox to hint at what the user should put inside of it? I want to do that with a password box. It's rather trivial with a text box, I just modify the get and set focus events to handle it all properly, but in a password box the text only shows up as the blocked out dots (except for the last character which is a nice touch).
Is there a way to do this? I was thinking about putting a textbox on top of the password box and hiding it on tap or something but that seems pretty ugly.
Update: I really like the PhoneTextBox control in the silverlight toolkit but it doesn't have any options for passwords. I'm really looking for a PasswordBox with the watermark capabilities. But it's proving much harder to find than I was hoping.
解決 3
So I ended up doing this technique: http://damianblog.com/2011/01/21/wp7-password-watermark/
It's pretty much what my first gut instinct was, it's a bit cheesy, and someone who's working on the silverlight toolkit should definitely try to implement this sometime.
他のヒント
The "gray overlaying text" on textboxes are commonly referred to as Watermarks
.
Easy way, just download the Silverlight for Windows Phone Toolkit and use the PhoneTextBox control.
You can check usage sample for the control here!
This may also fit your needs :-