Beispiel #1
0
 public void SetEditText(DisEditText newEditText)
 {
     this.editText = newEditText;
     SetText(this.text);
     SetEditable(this.editable);
     SetFontSize(this.fontSize);
     // this.editText.SetTextColor(Android.Graphics.Color.Rgb(98, 00, 237)); // "6200ED"
 }
Beispiel #2
0
 public void ClearEditText()
 {
     if (NSThread.IsMain)
     {
         this.text     = editText.Text; // save the last text before deallocation
         this.editText = null;
     }
     else
     {
         _ = BeginInvokeOnMainThreadAsync(() => { ClearEditText(); return(ack); }).Result;
     }
 }
Beispiel #3
0
        protected override void OnElementChanged(ElementChangedEventArgs <CustomTextEditView> e)
        {
            base.OnElementChanged(e);

            //Element is the virtual control that's being rendered in the renderer, e.g. Button, Entry, Frame etc.   Element : CustomTextEditView
            //Control is the platform implementation of that control, e.g.UIButton/Button, etc.                      Control : UITextView

            if (Control == null && Element != null)
            {
                CustomTextEditView view = Element as CustomTextEditView;
                editText = new DisEditText(view);
                view.SetEditText(editText); // export editText so we can use it from CustomTextEditView methods
                SetNativeControl(editText);
            }
            if (e.OldElement != null)
            {
                // Unsubscribe events
                CustomTextEditView view = e.OldElement as CustomTextEditView;
                if (view.textChangedDelegate != null)
                {
                    editText.Changed -= view.textChangedDelegate;
                }
                if (view.focusChangeDelegate != null)
                {
                    editText.Ended -= view.focusChangeDelegate;
                }
            }
            if (e.NewElement != null)
            {
                // Subscribe events
                CustomTextEditView view = e.NewElement as CustomTextEditView;
                if (view.textChangedDelegate != null)
                {
                    editText.Changed += view.textChangedDelegate;
                }
                if (view.focusChangeDelegate != null)
                {
                    editText.Ended += view.focusChangeDelegate;
                }
            }
        }