Silverlight - Password field no longer missing
Thursday, August 14th, 2008EDIT : There’s now a real PasswordField, our tricks is no longer needed, just read :
http://silverlight.net/blogs/msnow/archive/2008/09/29/silverlight-tip-of-the-day-47-how-to-implement-a-password-box.aspx
Everybody developping in Silverlight knows that there’s no password textbox, and some of us rewrite a UserControl to replace it… yeark !!
There’s a so simple way to create a password textbox :
Use a TextBox and change the font with a home made font in which all characters are ‘*’ …
0 lines of code, do it in XAML
<TextBox FontFamily="password.ttf#Password"/>
Download this code: password.xml
FontFamily can download a file and pick a font from this file, the syntaxe is given “file.ttf#fontname” in my password.ttf the font name is “Password”, with the .ttf have to be in your ClientBin (relatives or absolute URI can be used with nothing, the root directory is checked, so put it in your ClientBin)
According to TimHeuer’s comment, after beta 2, embedding fonts will not work with this way, so watch his video Using custom fonts in silverlight to do it with the right way :)
Dont want to create a .ttf ? download mine. password.ttf