Back to Devexpress

DevExpressServiceCollectionExtensions.AddDevExpressBlazor(IServiceCollection, Action<GlobalOptions>) Method

blazor-microsoft-dot-extensions-dot-dependencyinjection-dot-devexpressservicecollectionextensions-dot-adddevexpressblazor-x28-iservicecollection-action-globaloptions-x29.md

latest3.2 KB
Original Source

DevExpressServiceCollectionExtensions.AddDevExpressBlazor(IServiceCollection, Action<GlobalOptions>) Method

Adds internal DevExpress Blazor services to the IServiceCollection collection and sets up DevExpress Blazor components’ global options.

Namespace : Microsoft.Extensions.DependencyInjection

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public static IDevExpressBlazorBuilder AddDevExpressBlazor(
    this IServiceCollection services,
    Action<GlobalOptions> configure = null
)

Parameters

NameTypeDescription
servicesIServiceCollection

The application’s service collection.

|

Optional Parameters

NameTypeDefaultDescription
configureAction<GlobalOptions>null

A delegate method that configures global options for DevExpress Blazor components.

|

Returns

TypeDescription
IDevExpressBlazorBuilder

An object that can be used to further configure internal DevExpress Blazor services.

|

Remarks

Call this method in the Program.cs file to register internal DevExpress Blazor services. Pass global option values to this method to set options that apply to all DevExpress Blazor components.

The following code snippet sets the SizeMode global option to Large:

csharp
using DevExpress.Blazor;

/* ... */
builder.Services.AddDevExpressBlazor(configure => configure.SizeMode = SizeMode.Large);

The AddDevExpressBlazor method returns an object that you can use to further configure internal DevExpress Blazor services. For instance, you can call the AddSpellCheck method to add and configure the Rich Text Editor‘s built-in spell check service:

csharp
using DevExpress.Blazor;

/* ... */
builder.Services.AddDevExpressBlazor().AddSpellCheck();

See Also

DevExpressServiceCollectionExtensions Class

DevExpressServiceCollectionExtensions Members

Microsoft.Extensions.DependencyInjection Namespace