protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); if (e.OldElement != null) { ((INotifyCollectionChanged)blankPicker.Items).CollectionChanged -= RowsCollectionChanged; } if (!(e.NewElement is BlankPicker bPicker)) { return; } blankPicker = bPicker; if (Control != null) { Control.SpellCheckingType = UITextSpellCheckingType.No; Control.AutocorrectionType = UITextAutocorrectionType.No; Control.AutocapitalizationType = UITextAutocapitalizationType.None; Control.BorderStyle = UITextBorderStyle.RoundedRect; Control.AccessibilityTraits = UIAccessibilityTrait.Button; UIMenuController.SharedMenuController.MenuVisible = false; Control.EditingDidBegin += OnStarted; Control.Ended += OnEnded; Control.EditingChanged += OnEditing; if (IsiOS9OrNewer) { Control.InputAssistantItem.LeadingBarButtonGroups = null; Control.InputAssistantItem.TrailingBarButtonGroups = null; } _picker = new UIPickerView(); Control.InputView = _picker; _picker.Model = new PickerSource(this); Control.InputView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; SetInputAccessoryView(); UpdatePicker(); SetAttributes(); if (blankPicker.Items is INotifyCollectionChanged Collection) { Collection.CollectionChanged += RowsCollectionChanged; } } }
protected override void OnElementChanged(ElementChangedEventArgs <Picker> e) { base.OnElementChanged(e); if (!(e.NewElement is BlankPicker bPicker)) { return; } blankPicker = bPicker; if (Control == null) { SetNativeControl(new UITextField { RightViewMode = UITextFieldViewMode.Always, ClearButtonMode = UITextFieldViewMode.WhileEditing, }); } SetUIButtons(); SetPlaceholder(); SetAlignment(); }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); if (!(e.NewElement is BlankPicker bPicker)) { return; } blankPicker = bPicker; if (e.NewElement != null) { if (Control != null) { if (!string.IsNullOrEmpty(Control.Text)) { bPicker.Text = Control.Text; } Control.Focusable = true; Control.Clickable = false; Control.InputType = InputTypes.Null; blankPicker.Focused += OnClick; Control.Text = blankPicker.SelectedItem?.ToString(); Control.KeyListener = null; //Control.TextChanged += (sender, arg) // => bPicker.Text = arg.Text.ToString(); SetAttributes(); } } if (e.OldElement != null) { Control.SetOnClickListener(null); } }
protected override void OnElementChanged(ElementChangedEventArgs <Picker> e) { if (!(e.NewElement is BlankPicker bPicker)) { return; } blankPicker = bPicker; if (e.NewElement != null) { if (Control == null) { var textField = CreateNativeControl(); textField.SetOnClickListener(this); textField.InputType = InputTypes.Null; SetNativeControl(textField); } } base.OnElementChanged(e); SetPlaceholder(); SetAlignment(); Control.SetPadding(0, 7, 0, 3); Control.Gravity = Android.Views.GravityFlags.Fill; }