在我的 XAML 中,我有:
<PasswordBox PlaceholderText="Password" Name="login_password" Width="350" />
我试图通过以下方式检查PasswordBox
是否为空:
if(login_password.Text == "") //this returns an error
{
//show message box
}
如何检查PasswordBox
是否为空?
最佳答案
PasswordBox
有 Password
属性(property)。因此,您应该检查 Password
属性而不是 Text
:
if(login_password.Password == "")
关于c# - 检查密码字段是否为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44997178/