MonoTouch.Dialog.EntryElementCell.Update C# (CSharp) Method

Update() public method

public Update ( EntryElement element, UITableView tableView ) : void
element EntryElement
tableView UITableView
return void
		public void Update(EntryElement element, UITableView tableView){
			_element = element;

			if (_entry==null){
				PrepareEntry(tableView);
			}

			_entry.Font = element.Appearance.TextFieldFont;
			_entry.TextColor = element.ReadOnly ? element.Appearance.DisabledLabelTextColor : element.Appearance.TextFieldFontTextColor;

			TextLabel.Font = element.Appearance.LabelFont;
			TextLabel.TextColor = element.ReadOnly ? element.Appearance.DisabledLabelTextColor : element.Appearance.LabelTextColor;
			TextLabel.HighlightedTextColor = element.Appearance.LabelHighlightedTextColor;

			_entry.Enabled = !element.ReadOnly;
			_entry.Text = element.Value ?? "";
			_entry.RightText = element.AppendedText;
			if (_entry.GetType()==typeof(CustomTextField)) {
				((UILabel)((CustomTextField)_entry).RightView).TextColor = element.ReadOnly ? element.Appearance.DisabledLabelTextColor : element.Appearance.LabelTextColor;
			}

			_entry.TextAlignment = element.TextAlignment;
			_entry.Placeholder = element.Placeholder ?? "";
			_entry.SecureTextEntry = element.IsPassword;
			if (element.KeyboardType==UIKeyboardType.EmailAddress || element.IsPassword){
				_entry.AutocorrectionType = UITextAutocorrectionType.No;
				_entry.AutocapitalizationType = UITextAutocapitalizationType.None;
			} else {
				_entry.AutocorrectionType = UITextAutocorrectionType.Default;
				_entry.AutocapitalizationType = element.AutoCapitalize;
			}
			
			_entry.KeyboardType = element.KeyboardType;
            _entry.ReturnKeyType = element.ReturnKeyType;
			_entry.AutocorrectionType = element.AutoCorrection;
			TextLabel.Text = element.Caption;
			_entry.Hidden = element.Hidden;
			this.BackgroundColor = element.ReadOnly ? element.Appearance.BackgroundColorDisabled : element.Appearance.BackgroundColorEditable;
			this.UserInteractionEnabled = !element.ReadOnly;

			
			if (element.ShowToolbar || element.KeyboardType == UIKeyboardType.DecimalPad) {
				var toolbar = new UIToolbar {Translucent = true, Frame = new RectangleF(0,0,320,44)};
				_entry.InputAccessoryView = toolbar;

				toolbar.Items = new UIBarButtonItem[]{
					new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null, null),
					new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (e, a)=>{

						this.ResignFirstResponder();
					}) ,
				};
			};
		}