private void DOB_Unfocused(object sender, FocusEventArgs e) { string entryText = (sender as Entry)?.Text; DateFormatStructure dateTime = HelperMethods.DateValidationForDOB(entryText); if (!string.IsNullOrEmpty(entryText) && !dateTime.result) { ((NewAssessmentViewModel)this.BindingContext).DOBIsValid = true; DOBStackLayout.BackgroundColor = DOB.BackgroundColor = Color.FromHex("#FFF1F1"); DOB.Text = "mm/dd/yyyy"; DOB.TextColor = Color.FromHex("CC1417"); DOB.FontAttributes = FontAttributes.Bold; DOBFrame.BorderColor = Color.FromHex("#CC1417"); DOBImageFrame.BackgroundColor = Color.FromHex("#CC1417"); DOBImageFrame.BorderColor = Color.FromHex("#CC1417"); _dobErrorMsgShown = true; if (entryText == "mm/dd/yyyy" & _dobErrorMsgShown) { _dobErrorMsgShown = false; } } else if (DOB.Text.Length > 1) { DOB.Text = dateTime.time.Month + "/" + dateTime.time.Day + "/" + dateTime.time.Year; } }
private void TestDate_Unfocused(object sender, FocusEventArgs e) { string entryText = (sender as Entry)?.Text; DateFormatStructure dateTime = HelperMethods.DateValidation(entryText); if (!string.IsNullOrEmpty(entryText) && !dateTime.result) { ((ResumeSyncAssessmentViewModel)this.BindingContext).TestDateIsValid = true; TestDateStackLayout.BackgroundColor = TestDate.BackgroundColor = Color.FromHex("#FFF1F1"); TestDate.Text = "mm/dd/yyyy"; TestDate.TextColor = Color.FromHex("CC1417"); TestDate.FontAttributes = FontAttributes.Bold; TestDateFrame.BorderColor = Color.FromHex("#CC1417"); TestDateImageFrame.BackgroundColor = Color.FromHex("#CC1417"); TestDateImageFrame.BorderColor = Color.FromHex("#CC1417"); } }