C#/WPF取消隐藏密码框内的密码 [英] C# / WPF Unmask password inside the passwordBox
本文介绍了C#/WPF取消隐藏密码框内的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每当我单击复选框时,如何取消隐藏和屏蔽passwordBox中的密码?我正在使用C#WPF模板.
How could I unmasked and masked the password inside the passwordBox whenever I click the checkBox? I'm using C# WPF template.
这是我的.XAML代码:
Here is my .XAML code:
<PasswordBox x:Name="passwordBox_password" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="5" Height="25" />
<CheckBox x:Name="checkBox_showPassword" Grid.Row="3" Grid.Column="1" Margin="5,0,5,5" Content="show password" Checked="checkBox_showPassword_Checked" Unchecked="checkBox_showPassword_Unchecked" />
这是我的.CS代码:
private void checkBox_showPassword_Checked(object sender, RoutedEventArgs e)
{
// what to do here ?
}
private void checkBox_showPassword_Unchecked(object sender, RoutedEventArgs e)
{
// what to do here ?
}
或者在WPF中还有另一种方法吗?
Or is there another way to do it in WPF?
推荐答案
以下链接将带您进入寻找我的好先生的答案.拉马斯先生在回答如何做方面做得很出色,所以我希望将您重定向到答案:)
The following link will bring you to the answer you are looking for my good sir. Mr Lamas did a great job of answering the how-to so I'd rather redirect you to the answer :)
这篇关于C#/WPF取消隐藏密码框内的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文