I am trying to create a Login page that has validation errors. Right now the validation errors are also appearing if the Entry field is not visible. How would I hide the error l
Agree with Jason . You can use the data-binding to binding the IsVisible
of labelto the property in your viewmodel .
public class YourViewModel: INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public ICammand ClickCommand {get; set;}
private bool isvisible;
public bool isVisible
{
get
{
return isvisible;
}
set
{
if (isvisible!= value)
{
isvisible= value;
NotifyPropertyChanged();
}
}
public YourViewModel()
{
//...
isVisible = true; //show the label in default
ClickCommand = new Command(() =>
{
if(xxx)
{
isVisible =false;
}
else
{
isVisible =true;
}
}) ;
}
}