DevExpressServiceCollectionExtensions Class

Contains extension methods to configure an IServiceCollection for DevExpress Blazor components.

Namespace: Microsoft.Extensions.DependencyInjection

Assembly: DevExpress.Blazor.v21.1.dll


public static class DevExpressServiceCollectionExtensions


Use the AddDevExpressBlazor(IServiceCollection, Action<GlobalOptions>) method to add internal DevExpress Blazor services to the service collection or specify DevExpress Blazor components’ global options.

The AddDevExpressBlazor method is used to configure DevExpress Blazor services for your Blazor application. The DevExpress.Blazor NuGet package automatically adds this method to Blazor Server projects.

For Blazor WebAssembly projects, call the AddDevExpressBlazor method from your project’s Program.Main() method and pass global option values to this method (optional):

using Microsoft.Extensions.DependencyInjection;

public class Program {
    public static async Task Main(string[] args) {
        // builder.Services.AddDevExpressBlazor((options) => options.SizeMode = SizeMode.Medium); 
        await builder.Build().RunAsync();

To specify DevExpress Blazor components’ global options for Blazor Server applications, use the following code:

using Microsoft.Extensions.DependencyInjection;

class Startup {
    public void ConfigureServices(IServiceCollection services) {
        services.AddDevExpressBlazor((options) => options.SizeMode = SizeMode.Medium);


See Also