Skip to main content
All docs
V25.1
  • DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

    Take the survey Not interested

    ResourcesConfigurator Class

    Contains members that allow you to manage the Resource Manager’s script collection.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.Resources.v25.1.dll

    NuGet Package: DevExpress.Blazor.Resources

    #Declaration

    C#
    public class ResourcesConfigurator

    The following members return ResourcesConfigurator objects:

    #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 default script folder is wwwroot.

    Note: Omit the method call if you created a hybrid project. Our Blazor components obtain scripts for interaction automatically.

    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.

    #Inheritance

    Object
    ResourcesConfigurator
    See Also