Sometimes I need this intermediate land. For example, Command , which needs 3 values ββfrom CanExecute , rather than true or false .
As for the warnings, which act as checks, I donβt know all the parts that need to be assembled, but I think I know how to get started.
You will need to rely on attached properties and attached behaviors (attached properties that subscribe to events on the object and perform operations associated with these events when they are triggered). You may have one that manages the collection of ValidationRule objects that will be used to determine whether a warning is issued or not, similar to Validation properties. You can have one called HasWarning that is set or canceled by a check that can be referenced in style / template triggers.
You can make a warning display part for each control template, or you can imitate Validation again and have the WarningTemplate property WarningTemplate , which is used to place warning information in the AdornerLayer .
Since custom ValidationRule objects return a ValidationResult object in which ErrorContent is just an object, and this object also appears as ValidationError objects as ErrorContent , you can also use regular checking in the end. You could use the class as your ErrorContent object, which has the ErrorType property for warning or error and binds to it in the ErrorTemplate .
I'm not sure if having a ValidationError will prevent certain operations (like button clicks) that you would like to allow, but some kind of proxy server could be created in ViewModel that judges ErrorType .
Joel B Fant
source share