Skip to content

feature : Multiple validation context support #511

@brignolff

Description

@brignolff

Is your feature request related to a problem? Please describe.
Had a case where i needed to have validations that stop and block an external process and others that simply display the error without blocking or stopping anything. I also needed to display these validations separately.

Describe the solution you'd like
I thinked of having multiple validation contexts in a single ViewModel. To do so I made overloads for the "ValidationRule(...)" and "BindValidation(...)" methods. I added a "Func<TViewModel, ValidationContext> validationContextProperty" parameter to those methods and use it instead of the one present by default in the "IValidatableViewModel" interface.

Describe alternatives you've considered
An alternative could have been to create multiple validation classes inheriting from IValidationComponent but that also means adding methods to add them to the validation context. I would also need to create functions to filter them in order to know if a validation of type x is false.

Describe suggestions on how to achieve the feature
Made modifications of the code of this repo and uploaded everything on this github in the multiple validation context branch.
https://github.com/brignolff/Mdified.ReactiveUI.Vaidation/tree/multiple_validation_contexts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions