Skip to content

Blazored/FormExtensions

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

FormExtensions

A library with some Form Extensions for Blazor:

  • LabelText

Project

Build Status

NuGet Badge Blazored.FormExtensions

Installing

You can install from Nuget using the following command:

Install-Package Blazored.FormExtensions

Or via the Visual Studio NuGet package manager.

Usage

Start by add the following using statement to your root _Imports.razor.

@using Blazored.FormExtensions

Usage - LabelText

You can use this within a EditForm component:

<EditForm Model="@Model">
    <p>
        <LabelText For="@(() => Model.First)" />
        <InputText @bind-Value="@Model.First" />
    </p>

    <p>
        <LabelText For="@(() => Model.Last)" />
        <InputText @bind-Value="@Model.Last" />
    </p>

    <p>
        <LabelText For="@(() => Model.EmailAddress)" />
        <InputText @bind-Value="@Model.EmailAddress" />
    </p>
</EditForm>

@code {
    Person Model { get; set; } = new Person();
}

Configuration

ServiceSide Blazor

Make sure to setup and configure the IStringLocalizer correctly in the Startup.cs like:

public void ConfigureServices(IServiceCollection services)
{
+   services.AddRazorPages().AddViewLocalization(options => options.ResourcesPath = "Resources");
+   services.AddLocalization(options => options.ResourcesPath = "Resources");
+   services.AddSingleton(typeof(IStringLocalizer), typeof(StringLocalizer<SharedLocalization.SharedResources>));
}

ClientSide (WebAssembly) Blazor

Make sure to setup and configure the IStringLocalizer correctly in the Program.cs like:

public void ConfigureServices(IServiceCollection services)
{
+   builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
+   builder.Services.AddSingleton(typeof(IStringLocalizer), typeof(StringLocalizer<SharedLocalization.SharedResources>));
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages