Is there a way to hide or move the PasswordBox’s caret?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In .NET 3.5 SP1 or previous, there is no clean way to specify the color of a WPF TextBox/PasswordBox caret.
However, there is a way to specify (or in this case remove) that caret from view (via a hack). The caret color is the inverse color of the TextBox/PasswordBox’s background color. THus, you can make the background color “transparent black”, which will fool the system into using a white caret (which is not visible).
The code is (simply) as follows:
For further information on this issue, please check out the following links:
Note that in .NET 4.0 the Caret will be customizable.
Hope this helps!