PasswordBox没有Text属性,可以通过下面两种方法获取输入的值:
1、直接Password
var _pass = this.userPsss.Password;
MessageBox.Show(_pass);
2、使用IntPtr
// 使用一个IntPtr类型值来存储加密字符串的起始点
IntPtr ip = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this.userPsss.SecurePassword);
// 使用.NET内部算法把IntPtr指向处的字符集合转换成字符串
string _password = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(ip);
这篇文档对您是否有帮助?