A Microsoft framework for building cross-platform mobile apps using .NET and C# with native performance and user interfaces.
Enable a button in MVVM
Hello Microsoft
I Manege to disable and enable the button on Register, but I want to do the same with Login
VM
[AddINotifyPropertyChangedInterface]
public class LoginViewModel {
public ICommand OpenPopupCommand { get; set; }
public Command Register { get; set; }
public Command Login { get; set; }
public bool DisplayPopUp { get; set; }
public User User { get; set; }
public bool RegisterAllowed { get; set; }
public bool LoginAllowed { get; set; }
public LoginViewModel() {
User = new User {
OnAnyOfMyPropertiesChanged = () => Register.ChangeCanExecute()
};
OpenPopupCommand = new Command(() => {
DisplayPopUp = true;
});
Register = new Command(
execute: () => {
Debug.WriteLine(User);
},
canExecute: () => {
RegisterAllowed = User != null
&& !string.IsNullOrEmpty(User.Email)
&& !string.IsNullOrEmpty(User.Password)
&& User.Password.Equals(User.ConfirmPassword);
return RegisterAllowed;
});
Login = new Command(
execute: () => {
Debug.WriteLine(User);
},
canExecute: () => {
LoginAllowed = User != null
&& !string.IsNullOrEmpty(User.Email)
&& !string.IsNullOrEmpty(User.Password);
return RegisterAllowed;
});
}
}
}
Developer technologies | .NET | Xamarin
1 answer
Sort by: Most helpful
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
4 deleted comments
Comments have been turned off. Learn more