Пример #1
0
 protected virtual void BindTextField(ARTextField textField, MvxFluentBindingDescriptionSet <SignUpItemBaseViewCell, ISignUpItemBaseViewModel> set)
 {
     set.Bind(textField).To(vm => vm.Value);
     set.Bind(textField)
     .For(p => p.Error)
     .To(vm => vm.Invalid);
 }
        protected virtual void InitializeControls()
        {
            Frame = new CGRect(0, 0, (nfloat)PromoTheme.CodeFieldSize.Width, (nfloat)PromoTheme.CodeFieldSize.Height);

            var arr         = NSBundle.MainBundle.LoadNib(nameof(PromoCodeView), null, null);
            var viewFromNib = Runtime.GetNSObject <PromoCodeView>(arr.ValueAt(0));

            if (viewFromNib != null)
            {
                _textField             = viewFromNib._textField;
                _textField.Placeholder = LocalizationService.GetLocalizableString(LoyaltyConstants.RESX_NAME, "Promocode_Placeholder");

                if (_textField != null)
                {
                    SetupCodeField(_textField, _accessoryTextField = new ARTextField()
                    {
                        Frame = _textField.Frame, Placeholder = LocalizationService.GetLocalizableString(LoyaltyConstants.RESX_NAME, "Promocode_Placeholder")
                    });
                }

                viewFromNib.Frame            = Bounds;
                viewFromNib.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

                AddSubview(viewFromNib);
            }
        }
        public static void SetupStyle(this ARTextField view, Models.ThemeConfigs.TextField model)
        {
            view.Font = (UIFont)model.Font;
            view.AttributedPlaceholder = new NSMutableAttributedString(view.Placeholder ?? " ", (UIFont)model.Placeholder.Font, (UIColor)model.Placeholder.TextColor, kerning: model.Placeholder.Kerning ?? 0);
            view.TextColor             = (UIColor)model.TextColor;
            view.TextAlignment         = model.TextAlignment.ToUITextAlignment();
            view.TintColor             = (UIColor)model.TintColor;

            view.SeparatorColor   = (UIColor)model.SeparatorColor;
            view.InvalidTintColor = (UIColor)model.InvalidTintColor;
            view.TextTransform    = model.TextTransform;
            view.Kerning          = model.Kerning;

            if (model.Layer != null)
            {
                view.Layer.SetupStyle(model.Layer);
            }
        }