bug

I was using the masked edit and I encounter this bug where when I clear the masked edit value by using a function the mask format changed by itself. But when I clicked on it and type again it goes back to normal. Below is the code.

 private void clear(object sender, EventArgs e)
        {
           txtic.Value = "";
          txtdob.Value = "";
        }



        private void dobautofill()
        {
            var ic = txtic.Value.ToString().Substring(0, 6);
            Console.WriteLine(ic);
            var dob = DateTime.ParseExact(ic, "yyMMdd", CultureInfo.InvariantCulture);
            Console.WriteLine("ic dob: " + dob.ToString());
            //var realdob = DateTime.ParseExact(dob.ToString(), "yyMMdd", CultureInfo.InvariantCulture);
            //Console.WriteLine("real dob: " + realdob);
            Console.WriteLine(dob.ToString("ddMMyyyy", CultureInfo.InvariantCulture));
            txtdob.Value = dob.ToString("dd-MM-yyyy", CultureInfo.InvariantCulture);
            Console.WriteLine(txtdob.Value.ToString());
        }

        private void ageautofill()
        {
            var dob = DateTime.ParseExact(txtdob.Value.ToString().Substring(6), "yyyy", CultureInfo.InvariantCulture);
            var date = DateTime.ParseExact(DateTime.Now.Year.ToString(),"yyyy",CultureInfo.InvariantCulture);
            var age = date.Subtract(dob).TotalDays * 0.00273973;
            Console.WriteLine("date of birth: " + dob);
            Console.WriteLine("date: " + date);
            Console.WriteLine("age: " + Math.Floor(date.Subtract(dob).TotalDays / 365));
            txtage.Text = Math.Floor(age).ToString();
            //txtage.Text = DateTime.Now.Year.ToString();
        }

 void maskedic(object sender,Syncfusion.XForms.MaskedEdit.ValueChangedEventArgs e)
        {
            if (txtic.HasError)
            {
                DisplayAlert("Alert", "Please enter valid details", "OK");
            }
           
          
            if (txtic.Value.ToString() != "")
             {

                dobautofill();
                
            }
        }

        void maskeddob(object sender, Syncfusion.XForms.MaskedEdit.ValueChangedEventArgs e)
        {
            
            if (txtic.HasError)
            {
                DisplayAlert("Alert", "Please enter valid details", "OK");
            }
            if (txtdob.Value.ToString() != "")
            {
                ageautofill();
            }
        }

1 Reply

YK Yoganathan K Syncfusion Team May 31, 2018 10:45 AM UTC

Hi Junyi, 

  
We have already fixed the reported bug and this fix will be included in our upcoming 2018 volume 2 release which will be available by June 2018.  

  
Please let us know if you need any further assistance.    

  
Thanks,  
Yoganathan K 


Loader.
Up arrow icon