private static bool CheckIfFilledIn(UIElement element) { if (element == null) { return(true); } if (ViewMode.GetIsReadOnly(element)) //Read Only elements can't be required. { return(true); } if (!NovaValidation.GetIsRequired(element)) { return(true); } var textbox = element as TextBox; if (textbox != null) { return(!string.IsNullOrEmpty(textbox.Text)); } var combobox = element as ComboBox; if (combobox != null) { return(!string.IsNullOrEmpty(combobox.Text)); } var passwordBox = element as PasswordBox; if (passwordBox != null) { return(PasswordBoxMonitor.IsFilledIn(passwordBox)); } var validationBorder = element as ValidationBorder; if (validationBorder != null) { return(validationBorder.IsFilledIn); } return(true); //return true if we don't know what it is, so we don't block anything because of possibly faulty validation. }