Skip to main content
All docs
V24.2

ResourcesConfigurator.Resources Field

Returns the client resource collection that the Resource Manager loads.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.Resources.v24.2.dll

NuGet Package: DevExpress.Blazor.Resources

Declaration

public List<DxResource> Resources

Field Value

Type Description
List<DxResource>

A resource collection.

Remarks

If you use a DevExpress Blazor project template, your application automatically registers all scripts DevExpress libraries require. To register these scripts in other Blazor applications, call the DxResourceManager.RegisterScripts method in the Components/App.razor file:

<head>
    @*...*@
    @DxResourceManager.RegisterScripts()
</head>

The method parameter allows you to specify client resources to be registered. The Resources field returns the resource collection. Register(DxResource) and Unregister(DxResource) methods allow you to add or remove scripts.

The following example registers a custom script.js script and removes the Quill resource. Quill is unnecessary if an application does not include the HTML Editor component:

@DxResourceManager.RegisterScripts((config) => {
    config.Unregister(BlazorResources.QuillJS);
    var maxScriptPosition = config.Resources.OrderBy(o => o.Position).Last().Position;
    config.Register(new DxResource("script.js", maxScriptPosition + 1));
})

If you register a custom script, call the LoadDxResources(IJSRuntime) method before you execute the script’s API members for the first time. This method forces the Resource Manager to load client resources:

// ...
@code {
    [Inject] IJSRuntime js;
    protected override async Task OnAfterRenderAsync(bool firstRender) {
        if(firstRender) {
            await js.LoadDxResources();
            await js.InvokeAsync("a-method-from-a-custom-script");
        }
        await base.OnAfterRenderAsync(firstRender);
    }
}

Refer to the following topic for the list of DevExpress resources: DxResourceManager.

See Also