Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
135
Why I can input Feb. 30 in XamDateTimeEditor
posted

I think this is a bug that we can input invalid date. Although the validation can check this value.

I hope we can prevent user from inputting this invalid date.

Thanks

 

 

Parents
No Data
Reply
  • 5600
    Suggested Answer
    Offline posted

    Hello,

    You can hook to TextChanged event. And here is the event code:

    private void XamDateTimeEditor_TextChanged(object sender, RoutedPropertyChangedEventArgs<string> e)

            {

                if (dateTime.Mask == "{date}")

                {

                    if (dateTime.Text == "02/30/")

                    {

                        dateTime.Text = "";

                    }

                }

            }

    This will prevent you from typing '02/30/____'.

    Hope this helps.

    Regards,

    Anastas 

Children