protected override void SetupLayoutConstraints() { base.SetupLayoutConstraints(); this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); this.AddConstraints( BackgroundImage.FullSizeOf(this)); this.AddConstraints( LoginField.AtTopOf(this, 220), LoginField.AtLeadingOf(this, 50), LoginField.AtTrailingOf(this, 50), LoginField.Height().EqualTo(Theme.Dimensions.TextFieldHeight), PasswordField.Below(LoginField, 12), PasswordField.WithSameLeading(LoginField), PasswordField.WithSameWidth(LoginField), PasswordField.WithSameHeight(LoginField), SignInButton.Below(PasswordField, 16), SignInButton.WithSameCenterX(this), SignInButton.Width().EqualTo(218), SignInButton.Height().EqualTo(44), ErrorMessageView.Above(LoginField, 36), ErrorMessageView.WithSameLeading(LoginField), ErrorMessageView.WithSameWidth(LoginField), ErrorMessageTriangleImage.Below(ErrorMessageView), ErrorMessageTriangleImage.WithSameCenterX(this)); }
public override void ViewDidLoad() { base.ViewDidLoad(); SignInButton = new SignInButton(); View.AddSubview(SignInButton); View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); View.AddConstraints( SignInButton.Below(AppNameLabel, 70f) , SignInButton.WithSameCenterX(AppNameLabel) ); var set = this.CreateBindingSet <MainView, MainViewModel>(); set.Bind(SignInButton) .For(c => c.BindTouchUpInside()) .To(vm => vm.LoginCommand); set.Bind(SignInButton) .For(c => c.Hidden) .To(vm => vm.IsLoggedIn); set.Bind(LogoutButton) .For(c => c.BindVisible()) .To(vm => vm.IsLoggedIn); set.Bind(LogoutButton) .For(c => c.BindTouchUpInside()) .To(vm => vm.LogoutCommand); set.Bind(ViewGroupsButton) .For(c => c.BindVisible()) .To(vm => vm.IsLoggedIn); set.Bind(ViewGroupsButton) .For(c => c.BindTouchUpInside()) .To(vm => vm.GoToGroupsCommand); set.Apply(); }