Xamarin binding slash automatically

171 views Asked by At

How to set slash automatically once the date is typed (example 21/) slash should bind automatically once the user enters the date in edit text field in xamarin android.

1

There are 1 answers

0
Kuba On

Easiest way to do that is just formatting your string ;)

 TextBox text = new TextBox();
 text.Text = string.Format("{0}/{1}/{2}", text.Text.Substring(0, 2), 
                                          text.Text.Substring(2, 2), 
                                          text.Text.Substring(4, 4));

Of course you should fit substrings to your date format.