set password input on custom control label xamarin forms - Android render

758 Views Asked by At

my target is set password input on custom control in xamarin forms on .Droid project.

my custom render code:

class MyEntryRendererPassword : EntryRenderer
{
    //CUSTOM entry RENDER PER ANDROID
    protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
    {
        base.OnElementChanged(e);
        if (Control != null)
        {
            Control.SetMaxHeight(150);
            Control.SetTextColor(Android.Graphics.Color.Rgb(255,255,255));
            Control.SetBackgroundColor(Android.Graphics.Color.Rgb(43, 50, 58));
            //Control.SetRawInputType(InputTypes.TextFlagNoSuggestions | InputTypes.TextVariationVisiblePassword);

        }
    }
}

I have tested many codes that i saw online, but without success. How to set Control label like password label ? I will see the dots when user writing. Thanks.

1

There are 1 best solutions below

2
Gerald Versluis On BEST ANSWER

I think you need to set the InputType property, like:

Control.InputType = Android.Text.InputTypes.TextVariationPassword | 
                          Android.Text.InputTypes.ClassText;