View shows errors but not warnings

Topics: Questions
Sep 20, 2014 at 12:34 AM
I have a UserControl on a TabItem with a DataGrid. When there are validation errors in the grid data, they appear as expected in the info bar and the cells are highlighted. If I create validation warnings instead of errors, they do not appear. If I create errors for one column of data and warnings for the other, again only the errors appear.

I also have a DataWindow that I use as a popup and it displays both errors and warnings correctly.

Does anyone have a guess why my UserControl only displays errors and won't display warnings?

Thanks!
Coordinator
Sep 20, 2014 at 9:08 PM
Do you mean the controls itself or the info bar message control. If errors arrive, so should the warnings. Otherwise please prepare a repro.
Sep 22, 2014 at 4:19 PM
The info bar message control displays the errors, but not the warnings.
        protected override void ValidateFields(List<IFieldValidationResult> validationResults)
        {
            Argument.IsNotNull(() => validationResults);

            // Skip validation for this item if the ignore errors checkbox is true.
            if (!this.IgnoreValidationErrors)
            {
                if (this.PreviousStudentCount == 0)
                {
                    validationResults.Add(FieldValidationResult.CreateWarning(PreviousStudentCountProperty,
                         "The Previous Year Count for {0} is zero.  Is this correct?", this.ProgramName));
                }

                if (this.CurrentStudentCount == 0)
                {
                    validationResults.Add(FieldValidationResult.CreateWarning(CurrentStudentCountProperty,
                          "The Current Year Count for {0} is zero.  Is this correct?", this.ProgramName));
                }
            }
        }
If I change the above code from CreateWarning to CreateError, the error will display. If you change one, but not both, you'll still only see errors but not warnings.

I'll try to create a simplified repro.
Sep 22, 2014 at 11:50 PM
Checked in code for repro in CTL-535.

As I said in the remarks, because it works in the popup, but not on the tab item, I'm sure I'm doing something wrong. Thanks!