RadzenComponentActivator Class

Allows the developer to replace a component with another. Useful to specify default values for component properties.

Inheritance

Object

RadzenComponentActivator

Implements

IComponentActivator

Namespace: Radzen

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenComponentActivator : IComponentActivator

Examples

var builder = WebApplication.CreateBuilder(args);
var activator = new RadzenComponentActivator();
// Replace RadzenButton with MyButton
activator.Override<RadzenButton, MyButton>();
// Replace RadzenDataGrid with MyDataGrid
activator.Override(typeof(RadzenDataGrid<>), typeof(MyDataGrid<>));
// Register the activator
builder.Services.AddSingleton<IComponentActivator>(activator);

Constructors

RadzenComponentActivatorlink

Allows the developer to replace a component with another. Useful to specify default values for component properties.

Declaration
public RadzenComponentActivator()

Methods

CreateInstancelink

Creates a component of the specified type.

Declaration
public IComponent CreateInstance(Type componentType)
Parameters
Type Name Description
Type componentType
Returns
Type Description
IComponent

Overridelink

Replaces the specified component type with another.

Declaration
public void Override()

Overridelink

Replaces the specified component type with another.

Declaration
public void Override(Type original, Type override)
Parameters
Type Name Description
Type original
Type override
An error has occurred. This app may no longer respond until reloaded. Reload 🗙