feat: Handle Datavalidations on base class "Control" by timunie · Pull Request #20067 · AvaloniaUI/Avalonia (original) (raw)
What does the pull request do?
Simplify how DataValidations are handled.
What is the current behavior?
Every control developer need to override UpdateDataValidation method if they want to enable this feature on thier side.
What is the updated/expected behavior with this PR?
UpdateDataValidation is handled by default, thus implementation is easier and existing controls can be extended to support DataValidation. This idea was taken from this discussion: #20020 (reply in thread) . The discribed solution should now work.
Warning
this may be a breaking change in behavior, so I think it should not be backported.
Note
There is one TODO comment I left for MenuItem. Currently, a missing command will disable the control. But probably it would be better to either print a warning to the logs or throw an exception. It may be confusing for newbies otherwise. Let me know your thoughts.
Fixed issues
- I need to scan open issues if any will be fixed by this PR
- Fixes AutoCompleteBox validation broken #19681
- Fixes Binding validation error is not updated properly #16937