简体   繁体   English

TextBox作为PasswordBox

[英]TextBox as PasswordBox

Just have this quick question. 只是有一个快速的问题。 Can I some how make a TextBox to a PasswordBox, or just use "UseSystemPasswordChar". 我可以通过一些方法使TextBox成为PasswordBox,还是仅使用“ UseSystemPasswordChar”。

This is for windows phone. 这是用于Windows Phone。

Now have an icon that I can tap and want to display password and when keyup it hides it again. 现在有一个我可以点击并想要显示密码的图标,并在键入密码时再次将其隐藏。 But since this is for WP it may not bet that easy. 但是,由于这是针对WP的,因此可能并不容易。

Can't use a PasswordBox beacause that is not allowed on other parts of my application. 由于我的应用程序其他部分不允许使用PasswordBox,因此无法使用它。

UPDATE The textbox I am using looks like this: 更新我正在使用的文本框如下所示:

 <TextBox x:Name="password" BorderBrush="#BF000000" SelectionForeground="White" BorderThickness="2" SelectionBackground="#FF282A6C" Text="{Binding Path=PasswordSetting, Mode=OneWay, Source={StaticResource setting}}" TextChanged="sign_TextChanged_1" Foreground="Black" Background="White"/>

In codebehide if i had a password box i cant have passwordbox.Text.Lenght 在代码隐藏中,如果我有密码框,我无法拥有passwordbox.Text.Lenght

UPDATE 2 更新2

I solved it, this was a dumb question from the beggning. 我解决了这个问题,这是一个愚蠢的问题。

You can use the TextBox control by settings its TextMode attribute to Password . 您可以通过将TextBox控件的TextMode属性设置为Password来使用它。 This should be handled as an ordinary HTML Input that masks for passwords... 这应该作为屏蔽密码的普通HTML输入来处理...

<asp:TextBox ID="password" runat="server" TextMode="Password" />

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

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