login - WPF textbox/password box text disappear on click -


i'm making login screen wpf application. want 2 textboxes, 1 username , password.

for username, have used textbox , added text ('username') disappears when user clicks on enter username. done code below.

i can't seem replicate password. don't believe i'll able use textbox wont able disguise user input *'s or whatever, , cant figure out way hardcode 'password' box disappear when user clicks.

how can this? know possible loads of sites have functionality cant figure out after googling long time!

i should stress im new programming answers aimed @ complete novice appreciated!

thanks

xaml: gotfocus="usernametextbox_ongotfocus" foreground="#ffa19da1"/>

private void usernametextbox_ongotfocus(object sender, routedeventargs e)     {         usernametextbox.text = "";     } 

username example here

looks need customize password box little bit. 1 way achieve create usercontrol password box , textblock on it. on gotfocus password box set visibility of textblock collapsed. , dont forger set hittestvisible=false textblock.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -