How to disable the text editing feature of keyboard in xamarin forms?

Viewed 212

I want to disable the text editing feature of the keyboard which allows the keyboard to copy paste the values in Entry. This is my renderer code.

protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
    base.OnElementChanged(e);
    if (Control != null)
    {                  
        Control.InputType = Android.Text.InputTypes.ClassText; 
                  
        Control.CustomSelectionActionModeCallback = new Callback();
        Control.CustomInsertionActionModeCallback = new Callback();
        Console.WriteLine("CustomSelectionActionModeCallback");
                  
        Control.SetTextIsSelectable(false);
        Control.LongClickable = false;
        Control.SetOnTouchListener(EntryTouchListener.Instance.Value);
    }
}

This is the MyEntry class code

public class MyEntry : Entry
{
    public MyEntry()
    {
        BackgroundColor = Color.Gray;
        Keyboard = Keyboard.Create(KeyboardFlags.None);
    }
}

I have tried to set the KeyboardFlags as none as suggested in the following suggestion

Can I prevent keyboard suggestions from Xamarin.forms

Still it didn't help. This is how my UI looks like

enter image description here

enter image description here

enter image description here

I have to hide or disable the text editing feature from my keyboard. I have no clue how to fix this issue. Any suggestions?

0 Answers
Related