Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Custom Renderer Entry Numeric to Text

$
0
0

Hi, I currently have this custom renderer for my entries, but all my entry keyboards change to numeric when I use this. How do I prevent this?

<br /> [assembly: ExportRenderer(typeof(Entry), typeof(MyEntryRenderer))]<br /> namespace (name).Droid.CustomRenderers<br /> {<br /> class MyEntryRenderer : EntryRenderer<br /> {<br /> public MyEntryRenderer(Context context) : base(context)<br /> {<br /> }</p> <pre><code> protected override void OnElementChanged(ElementChangedEventArgs<Entry> e) { base.OnElementChanged(e); // update native EditText control to auto-select all text on focus if (e.OldElement == null) { var nativeEditText = (global::Android.Widget.EditText)Control; nativeEditText.SetSelectAllOnFocus(true); } if (this.Control != null) { // HACK:: allows commas to be used for folks in locales where comma is used as a decimal this.Control.KeyListener = DigitsKeyListener.GetInstance("1234567890.,"); } // setting this background color to transparent gets rid of the underline normally seen in Android edit fields this.Control?.SetBackgroundColor(Android.Graphics.Color.Transparent); } }

}


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>