Example #1
0
        public override void InitializeContent()
        {
            if (EditMode != EditMode.ReadOnly)
            {
                Entry = new UICustomTextField()
                {
                    BackgroundColor        = UIColor.Clear,
                    PlaceholderColor       = Theme.PlaceholderColor,
                    PlaceholderAlignment   = Theme.PlaceholderAlignment,
                    VerticalAlignment      = UIControlContentVerticalAlignment.Center,
                    AutocorrectionType     = AutoCorrectionType,
                    AutocapitalizationType = AutoCapitalizationType,
                    Tag = 1
                };

                if (EditMode == EditMode.NoCaption)
                {
                    Entry.Placeholder = Caption;
                }
                else
                {
                    Entry.Placeholder = Placeholder;
                }

                Entry.SecureTextEntry = IsPassword;
                Entry.Font            = DetailTextFont;
                Entry.KeyboardType    = KeyboardType;
                Entry.TextAlignment   = DetailTextAlignment;
                Entry.ReturnKeyType   = ReturnKeyType;

                if (DetailTextColor != null)
                {
                    Entry.TextColor = DetailTextColor;
                }

                _KeyboardToolbar         = new UIKeyboardToolbar(this);
                Entry.InputAccessoryView = _KeyboardToolbar;
                Entry.ReturnKeyType      = UIReturnKeyType.Default;

                Entry.Started += (s, e) =>
                {
                    ValueProperty.ConvertBack <string>();
                };

                Entry.ShouldReturn = delegate
                {
                    Entry.ResignFirstResponder();

                    return(true);
                };

                Entry.EditingDidEnd += delegate
                {
                    ValueProperty.Update();
                    Entry.SetNeedsDisplay();
                };


                ContentView = Entry;
            }
            else
            {
                if (DetailTextLabel != null)
                {
                    DetailTextLabel.Text = Value;
                }
            }
        }