private void SetupBinding()
        {
            EmailTextField.EditingChanged += (s, e) => { };
            Bindings.Add(this.SetBinding(
                             () => EmailTextField.Text,
                             () => Vm.Email,
                             BindingMode.OneWay));

            NameTextField.EditingChanged += (s, e) => { };
            Bindings.Add(this.SetBinding(
                             () => NameTextField.Text,
                             () => Vm.UserName,
                             BindingMode.OneWay));

            PasswordTextField.EditingChanged += (s, e) => { };
            Bindings.Add(this.SetBinding(
                             () => PasswordTextField.Text,
                             () => Vm.Password,
                             BindingMode.OneWay));

            Bindings.Add(this
                         .SetBinding(() => Vm.EmailValidationError)
                         .WhenSourceChanges(() =>
            {
                if (Vm.EmailValidationError)
                {
                    EmailTextField.Shake();
                }
            }));

            Bindings.Add(this
                         .SetBinding(() => Vm.UserNameValidationError)
                         .WhenSourceChanges(() =>
            {
                if (Vm.UserNameValidationError)
                {
                    NameTextField.Shake();
                }
            }));

            Bindings.Add(this
                         .SetBinding(() => Vm.PasswordValidationError)
                         .WhenSourceChanges(() =>
            {
                if (Vm.PasswordValidationError)
                {
                    PasswordTextField.Shake();
                }
            }));

            SignUpButton.TouchUpInside += (s, e) => { };
            SignUpButton.SetCommand(
                "TouchUpInside",
                Vm.SignUpCommand);
        }
Exemple #2
0
        //OnCreate
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //Set Layout
            SetContentView(Resource.Layout.activity_signin);

            //binding
            _usernameBinding = this.SetBinding(() => EditUserName.Text, () => Vm.UserName);
            _passwordBinding = this.SetBinding(() => EditPassword.Text, () => Vm.Password);

            SignInButton.SetCommand("Click", Vm.LoginCommand);
            SignUpButton.SetCommand("Click", Vm.SignUpCommand);
        }