Inheritance: UIInputViewToolbar
Exemplo n.º 1
0
		public override void InitializeContent()
		{ 
			if (EditMode != EditMode.ReadOnly)
			{
				_InputControl = new UIPlaceholderTextField(new RectangleF(0, 0, Cell.Bounds.Width, Cell.Bounds.Height)) 
				{ 
					BackgroundColor = UIColor.Clear, 
					PlaceholderColor = Theme.PlaceholderColor, 
					PlaceholderAlignment = Theme.PlaceholderAlignment,
					VerticalAlignment = UIControlContentVerticalAlignment.Center,
					AutocorrectionType = AutoCorrectionType,
					AutocapitalizationType = AutoCapitalizationType,
					Tag = 1 
				};
		
				if (EditMode == EditMode.NoCaption)
					_InputControl.Placeholder = Caption;
				else
					_InputControl.Placeholder = Placeholder;
				
				_InputControl.SecureTextEntry = IsPassword;
				_InputControl.Font = Theme.DetailTextFont;
				_InputControl.KeyboardType = KeyboardType;
				_InputControl.TextAlignment = Theme.DetailTextAlignment;
				_InputControl.ReturnKeyType = ReturnKeyType;

				if (Theme.DetailTextColor != null)
					_InputControl.TextColor = Theme.DetailTextColor;
				
				_KeyboardToolbar = new UIKeyboardToolbar(this);
				_InputControl.InputAccessoryView = _KeyboardToolbar;

				_InputControl.ReturnKeyType = UIReturnKeyType.Default;

				_InputControl.Started += (s, e) =>
				{
					//DataContextProperty.ConvertBack<string>();				
				};
			
				_InputControl.ShouldReturn = delegate
				{
					_InputControl.ResignFirstResponder();

					return true;
				};
				
				_InputControl.EditingDidEnd += delegate 
				{
					DataBinding.UpdateDataContext();
				};

				ElementView = _InputControl;
			}
		}
Exemplo n.º 2
0
		public override void InitializeContent()
		{ 
			if (EditMode != EditMode.ReadOnly)
			{
				_InputControl = new UICustomTextView(new RectangleF(0, 0, Cell.Bounds.Width, Cell.Bounds.Height)) 
				{ 
					BackgroundColor = UIColor.Clear, 
					AutocorrectionType = AutoCorrectionType,
					AutocapitalizationType = AutoCapitalizationType,
					AlwaysBounceVertical = false,
					AlwaysBounceHorizontal = false,
					ScrollEnabled = true,
					Font = UIFont.SystemFontOfSize(UIFont.LabelFontSize),
					TextColor = UIColor.DarkTextColor,
					Tag = 1,	
				};
				
				_InputControl.AutoScroll = Lines > 0;

				if (Theme.DetailTextFont != null)
					_InputControl.Font = Theme.DetailTextFont;
	
				if (Theme.DetailTextColor != null)
					_InputControl.TextColor = Theme.DetailTextColor;

				_InputControl.KeyboardType = KeyboardType;
				_InputControl.TextAlignment = Theme.DetailTextAlignment;
				_InputControl.ReturnKeyType = ReturnKeyType;
				
				_KeyboardToolbar = new UIKeyboardToolbar(this);
				 _InputControl.InputAccessoryView = _KeyboardToolbar;

				_InputControl.Started += (s, e) =>
				{
					//DataContextProperty.ConvertBack<string>();	
				};
				
				_InputControl.Changed += InputControlTextChanged;

				_InputControl.Ended += delegate 
				{ 			
					DataBinding.UpdateDataContext();

					_InputControl.ContentOffset = new PointF(0, 8);

				};

				ElementView = _InputControl;
			}
		}