What is the role of the EditContext in Blazor forms and how does it track validation states and field changes?
Last updated
EditContextis the coordinating object behind a Blazor form: it wraps the model being edited and is cascaded byEditFormto all input components.It tracks per-field state (modified via
IsModified()plus validation messages), keyed byFieldIdentifier(model object + property name).It raises
OnFieldChanged(per-field re-checks) andOnValidationRequested(whole-model validation on submit orValidate()), which validators subscribe to.
- https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/binding?view=aspnetcore-10.0
- https://blazor-university.com/forms/editcontext-fieldidentifiers-and-fieldstate/
- https://chrissainty.com/3-ways-to-communicate-between-components-in-blazor/
- https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/troubleshoot?view=aspnetcore-10.0
- https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/validation?view=aspnetcore-10.0
- https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/?view=aspnetcore-10.0
- https://chrissainty.com/creating-a-custom-validation-message-component-for-blazor-forms/
- https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/input-components?view=aspnetcore-10.0