RequiredIf - Extend the validation in Blazor
Just imagine you have your beautiful model in a form. And Blazor is very kind and does validation for you. It is really straight forward because you can annotate your model with some attributes like
RequiredAttribute to tell Blazor: "Hey this property has to be set, otherwise the form will not be submitted."
But what if you want to have that easy setup with attributes but also want to say to Blazor: "Hey this property has to be set, if the other property is true.* Well, that does not work out of the box. So let's make it together!
Read the whole article