dotnet / MobileBlazorBindings

Experimental Mobile Blazor Bindings - Build native and hybrid mobile apps with Blazor
MIT License
1.2k stars 170 forks source link

Provide alternative to EditForm components for native controls for validation #233

Open Dreamescaper opened 3 years ago

Dreamescaper commented 3 years ago

I would love to be able to use same validations techniques as in Web Blazor, with DataAnnotationsValidator or third-party FluentValidator.

I'd expect it to be something like that:

<CascadedEditContext Model="@MyModel"> 
    <DataAnnotationsValidator /> 
    # or
    <FluentValidator />

    <ValidatedEntry @bind-Text="@Model.Username" />
    <ValidationLabel For="@Model.Username" />

    <ValidatedEntry @bind-Text="@Model.Password" />
    <ValidationLabel For="@Model.Password" />

    <SubmitButton OnValidSubmit="@Login" />
<CascadedEditContext />

Those controls should probably go to separate project, e.g. Microsoft.MobileBlazorBindings.Forms or Microsoft.MobileBlazorBindings.Validation.

Dreamescaper commented 3 years ago

Some open questions.