37 lines
841 B
C#
37 lines
841 B
C#
|
using System.Security;
|
|||
|
using System.Windows;
|
|||
|
|
|||
|
namespace WPF控件_14_PasswordBox;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Interaction logic for MainWindow.xaml
|
|||
|
/// </summary>
|
|||
|
public partial class MainWindow : Window
|
|||
|
{
|
|||
|
public MainWindow()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
}
|
|||
|
|
|||
|
private void ClearButton_OnClick(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
PasswordBox.Clear();
|
|||
|
}
|
|||
|
|
|||
|
private void PasteButton_OnClick(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
PasswordBox.Paste();
|
|||
|
}
|
|||
|
|
|||
|
private void SelectAllButton_OnClick(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
PasswordBox.SelectAll();
|
|||
|
var secureString = new SecureString();
|
|||
|
secureString.Dispose();
|
|||
|
}
|
|||
|
|
|||
|
private void PasswordBox_OnPasswordChanged(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
Console.WriteLine(PasswordBox.Password);
|
|||
|
}
|
|||
|
}
|