문제

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.

http://www.c-sharpcorner.com/UploadFile/74f20d/create-a-watermark-textbox-effect-from-window-phone-7/

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 :-

http://watermarktextbox.codeplex.com/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top