ValidationSummary

Topics: Issues / bugs, Questions
Nov 19, 2014 at 6:40 AM
Hi. Sorry but at the moment I have a lot of Problems with the validation.

I have validtaion Errors. The InfoBarMessageControl displays the errors.
But the Button I created with the validtaionsummary is still enabled.
And also the ValidationSummary.FieldErrors.Count and ValidationSummary.BusinessRuleErrors.Count returns 0

I have to refresh the view to get the excepted result.

Do I need the ValidationSummaryProperty on every nested viewmodel?
Coordinator
Nov 19, 2014 at 9:43 AM
Please try the following:

1) Double check the source please
2) Check if you find something that might already fix the issue to make our lives easier
3) Create a repro please


We are really busy with our normal jobs as well. We created a lot of documentation to prevent questions, most people can find the solution without consulting us. It's really hard for us to provide so much support.
Nov 19, 2014 at 11:15 AM
Yes ok. I understand.

The validation is a little bit complex.

My main problem is that I need to validate the whole chain from grandparent to childviewmodel if any property is changed in childviewmodel.
  1. Validation is not started in the parent and grandparentviewmodel if i change a property in childviewmodel
    -> So I have a InterestedIn Attribut in grandparent if a property changed in childviewmodel I call Validate. And so Validation is started from top.
  2. In Parentviewmodel I need informations of childs to validate businessRules for overall validation. In Parentviewmodel there is no reference to childviewmodel.
    (by design thats ok) But the model of the parentviewmodel has a reference to childmodel. So I can use the propertys of the childmodel for my validation. But:
    The Propterty which have caused the validation has the old value in childmodel. So I have to start the validation 2 times.
    The first validation is started from: see 1.
    The second validation is started with the ChangeNotificationWrapper on the models:
        private void SubscribePlacementValidation()
        {
            foreach (var wrapper in (
                from station in Stations
                from block in station.Locations
                from place in block.Locations.Where(place => place is PlaceInstance)
                select new ChangeNotificationWrapper(place)).Where(wrapper => wrapper != null))
            {
                wrapper.PropertyChanged += OnPropertyChanged;
                _wrappers.Add(wrapper);
            }
        }

        private void OnPropertyChanged(object sender, PropertyChangedEventArgs eventArgs)
        {
            if (TagHelper.AreTagsEqual(eventArgs.PropertyName, "SelectedUnit") ||
                TagHelper.AreTagsEqual(eventArgs.PropertyName, "SelectedHardwareInstance"))
            {
                Validate(true);
            }
        }
And this is causing lots of more problems.

My Application is very complex. And its very difficult to make a repro to show the problems I have.

Maybe you can help me at least with one question: How to get the new value from child which is causing the validation. Without starting the validation seperate with
ChangeNotificationWrapper.
Nov 19, 2014 at 12:20 PM
Made a repro. :-)

I add a issue and post the link.
Nov 19, 2014 at 12:30 PM
Here the link:

https://catelproject.atlassian.net/browse/CTL-553

The repro contains only some off my problems with the validation.