public override void ViewWillAppear (bool animated)
		{
			base.ViewWillAppear(animated);
			
			var items = new List<object>();
		
			for(int i = 0;i <= 10;i++)
			{
				items.Add (i);
			}
			chickenName = new EntryElement("Name Of", null, "");
			chickenName.Value = "Big Bird";
			
			rating = new PickerElement("Rating", items.ToArray(), null, this) {
				Width = 40f,
				ValueWidth = 202f, // use this to align picker value with other elements, for the life of me I can't find a calculation that automatically does it.
				Alignment = UITextAlignment.Left
			};			
			// set initial rating.
			rating.Value = "5";
			rating.SetSelectedValue(rating.Value);
			
			date = new DateTimeElement2("Date", DateTime.Now, this) {
				Alignment = UITextAlignment.Left,
				Mode = UIDatePickerMode.Date
			};
			
			Root = new RootElement("Rate Chicken") {
				new Section() {
					chickenName,
					rating,
					date
				}
			};		
		}
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var items = new List <object>();

            for (int i = 0; i <= 10; i++)
            {
                items.Add(i);
            }
            chickenName       = new EntryElement("Name Of", null, "");
            chickenName.Value = "Big Bird";

            rating = new PickerElement("Rating", items.ToArray(), null, this)
            {
                Width      = 40f,
                ValueWidth = 202f,                 // use this to align picker value with other elements, for the life of me I can't find a calculation that automatically does it.
                Alignment  = UITextAlignment.Left
            };
            // set initial rating.
            rating.Value = "5";
            rating.SetSelectedValue(rating.Value);

            date = new DateTimeElement2("Date", DateTime.Now, this)
            {
                Alignment = UITextAlignment.Left,
                Mode      = UIDatePickerMode.Date
            };

            Root = new RootElement("Rate Chicken")
            {
                new Section()
                {
                    chickenName,
                    rating,
                    date
                }
            };
        }
Ejemplo n.º 3
0
        public IFormElement Render()
        {
            IFormElement element;

            switch (Type)
            {
            case FormElementType.Entry:
                element = new EntryElement();
                break;

            case FormElementType.Address:
                element = new AddressElement();
                break;

            case FormElementType.DatePicker:
                element = new DatePickerElement();
                break;

            case FormElementType.Picker:
                element = new PickerElement();
                break;

            case FormElementType.Editor:
                element = new EditorElement();
                break;

            case FormElementType.Switch:
                element = new SwitchElement();
                break;

            case FormElementType.CheckboxList:
                element = new CheckboxListElement();
                break;

            case FormElementType.Hidden:
                element = new HiddenElement();
                break;

            case FormElementType.Button:
                element = new ButtonElement();
                break;

            case FormElementType.Label:
                element = new LabelElement();
                break;

            default:
                element = new EntryElement();
                break;
            }
            element.Label         = this.Label;
            element.Key           = Key;
            element.Keyboard      = Keyboard;
            element.HeightRequest = HeightRequest;
            element.Options       = Options;
            element.Required      = Required;
            element.Attributes    = Attributes;
            element.AutoPostBack  = AutoPostBack;

            if (!string.IsNullOrWhiteSpace(ElementBackgroundColor))
            {
                element.ElementBackgroundColor = (Color) new ColorTypeConverter().ConvertFromInvariantString(ElementBackgroundColor);
            }

            if (!string.IsNullOrWhiteSpace(ElementTextColor))
            {
                element.ElementTextColor = (Color) new ColorTypeConverter().ConvertFromInvariantString(ElementTextColor);
            }

            element.Render();
            if (!string.IsNullOrWhiteSpace(Value))
            {
                element.Value = Value;
            }

            return(element);
        }