Reputation: 627
I need to verify whether an object is visible or not, I tried to write this code, but It doesn't work (NullReferenceException):
if (PasswordConfirm.Visibility != Visibility.Collapsed)
{
labelInsertPassword.Visibility = Visibility.Collapsed;
PasswordConfirm.Visibility = Visibility.Collapsed;
}
How can I do that? Thank you!
Upvotes: 1
Views: 663
Reputation: 6342
The following snippt works fine in my case.You need to show other code associating with that to get good solution..
if (passwordBox1.Visibility == Visibility.Visible)
MessageBox.Show("Visible");
else
MessageBox.Show("Not visible");
Upvotes: 3