Example #1
0
        public NewUserSignUpPage()
        {
            On <iOS>().SetUseSafeArea(true);

            BackgroundColor = Color.FromHex("#2980b9");

            _usernameEntry = new UnderlinedEntry("Username", AutomationIdConstants.NewUserSignUpPage_NewUserNameEntry)
            {
                ReturnType = ReturnType.Next
            };

            _passwordEntry = new UnderlinedEntry("Password", AutomationIdConstants.NewUserSignUpPage_NewPasswordEntry)
            {
                IsPassword    = true,
                ReturnType    = ReturnType.Go,
                ReturnCommand = new Command(() => HandleSaveUsernameButtonClicked(_saveUsernameButton, EventArgs.Empty))
            };

            _saveUsernameButton = new BorderedButton("Save Username", AutomationIdConstants.NewUserSignUpPage_SaveUsernameButton)
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.EndAndExpand
            };
            _saveUsernameButton.Clicked += HandleSaveUsernameButtonClicked;

            _cancelButton = new BorderedButton("Cancel", AutomationIdConstants.NewUserSignUpPage_CancelButton)
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.End
            };

            _cancelButton.Clicked += (object sender, EventArgs e) =>
            {
                Navigation.PopModalAsync();
            };

            var layout = new StackLayout
            {
                Padding         = new Thickness(20, 50, 20, 20),
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    new WhiteTextLabel("Please enter username"),
                    _usernameEntry,
                    new WhiteTextLabel("Please enter password"),
                    _passwordEntry,
                    _saveUsernameButton,
                    _cancelButton
                }
            };

            Content = new Xamarin.Forms.ScrollView {
                Content = layout
            };
        }
Example #2
0
 protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
 {
     base.OnElementChanged(e);
     if (Control != null)
     {
         UnderlinedEntry ue = (UnderlinedEntry)this.Element;
         this.bottomView.BackgroundColor = ue.BottomLineColor.ToUIColor();
         //Control.AddSubview (this.bottomView);
         Control.BorderStyle = UITextBorderStyle.None;
     }
 }
 void SetFontSize(UnderlinedEntry view)
 {
     if (view.FontSize != Font.Default.FontSize)
     {
         Control.Font = UIFont.SystemFontOfSize((System.nfloat)view.FontSize);
     }
     else if (view.FontSize == Font.Default.FontSize)
     {
         Control.Font = UIFont.SystemFontOfSize(17f);
     }
 }
 void SetPlaceholderTextColor(UnderlinedEntry view)
 {
     if (string.IsNullOrEmpty(view.Placeholder) == false && view.PlaceholderColor != Color.Default)
     {
         var placeholderString = new NSAttributedString(view.Placeholder,
                                                        new UIStringAttributes {
             ForegroundColor = view.PlaceholderColor.ToUIColor()
         });
         Control.AttributedPlaceholder = placeholderString;
     }
 }
        void DrawBorder(UnderlinedEntry view)
        {
            var borderLayer = new CALayer
            {
                MasksToBounds = true,
                Frame         = new CoreGraphics.CGRect(0f, Frame.Height / 2, Frame.Width, 1f),
                BorderColor   = view.BorderColor.ToCGColor(),
                BorderWidth   = 1.0f
            };

            Control.Layer.AddSublayer(borderLayer);
            Control.BorderStyle = UITextBorderStyle.None;
        }