简体   繁体   English

如何让TextBox使用密码字符而不是在wpf中使用passwordbox?

[英]How to make TextBox to use password characters instead of using passwordbox in wpf?

Is there any change to make TextBox to use password characters instead of using passwordbox in wpf ? 是否有任何更改使TextBox使用密码字符而不是在wpf中使用passwordbox?

<PasswordBox Height="42" Width="200"  Margin="22,28,28,0" 
     Name="passwordBox1" VerticalAlignment="Top" 
     Background="LightBlue" Foreground="DarkBlue" 
     MaxLength="25" PasswordChar="*" 
     />

with above code i can get the result what i need but I have to achieve the same result using textbox instead of passwordbox .what should i do for that. 使用上面的代码我可以得到我需要的结果,但我必须使用文本框而不是密码框来实现相同的结果。我该怎么做。

The TextBox does not have have a "password mode". TextBox没有“密码模式”。 PasswordBox is the only way to go. PasswordBox是唯一的出路。

You can change a textbox as a password box, by changing the property of textbox. 您可以通过更改文本框的属性将文本框更改为密码框。

First you create a textbox and press F4. 首先,创建一个文本框,然后按F4。 property will open. 物业将开放。 on that look for 'passwordchar' and change that into '*'. 在那个寻找'passwordchar'并将其更改为'*'。 and change whatever you want,like maximum length. 并改变你想要的任何东西,比如最大长度。

I think it will help to you.. 我认为这会对你有所帮助..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM