DevExpressWasmMasksServiceCollectionExtensions.AddDevExpressBlazorWasmMasks(IServiceCollection) Method
Adds internal DevExpress Blazor services to IServiceCollection and sets up client-side masks in Blazor Server applications.
Namespace: Microsoft.Extensions.DependencyInjection
Assembly: DevExpress.Blazor.Server.WebAssembly.v21.2.dll
NuGet Package: DevExpress.Blazor.Server.WebAssembly
Declaration
public static void AddDevExpressBlazorWasmMasks(
this IServiceCollection services
)
Parameters
Name | Type | Description |
---|---|---|
services | IServiceCollection | A IServiceCollection object that specifies the service collection. |
Remarks
The AddDevExpressBlazorWasmMasks method adds internal DevExpress Blazor services to IServiceCollection and sets up client-side (WebAssembly) masks in your Blazor Server application. In this mode, data editors with masks process input text on the client to reduce input delays when you have a slow connection. For more information on the mode, refer to the following section: Optimize Mask Performance in Blazor Server Apps.
To activate this functionality, follow the steps below:
.NET 5.0
- Install the
DevExpress.Blazor.Server.WebAssembly
NuGet Package. Register the middleware. Call the UseDevExpressBlazorWasmMasksStaticFiles(IApplicationBuilder) method from the
Startup.cs
file’sConfigure
method:using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; public void Configure(IApplicationBuilder app, IHostingEnvironment env) { // ... app.UseStaticFiles(); app.UseDevExpressBlazorWasmMasksStaticFiles(); // ... }
Set up mask-related options. Call the AddDevExpressBlazorWasmMasks method from the
Startup.cs
file’sConfigureServices
method:using Microsoft.Extensions.DependencyInjection; public void ConfigureServices(IServiceCollection services) { // ... services.AddDevExpressBlazor(); services.AddDevExpressBlazorWasmMasks(); }
.NET 6.0
- Install the
DevExpress.Blazor.Server.WebAssembly
NuGet Package. Register the middleware. Call the UseDevExpressBlazorWasmMasksStaticFiles(IApplicationBuilder) method in the
Program.cs
file:app.UseDevExpressBlazorWasmMasksStaticFiles();
Set up mask-related options. Call the AddDevExpressBlazorWasmMasks method in the
Program.cs
file:builder.Services.AddDevExpressBlazorWasmMasks();