Class RadzenComponentActivator
Allows the developer to replace a component with another. Useful to specify default values for component properties.
Implements
Inherited Members
Namespace: Radzen
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenComponentActivator : IComponentActivatorExamples
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
RadzenComponentActivator()
Allows the developer to replace a component with another. Useful to specify default values for component properties.
Declaration
public RadzenComponentActivator()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);Methods
CreateInstance(Type)
Creates a component of the specified type.
Declaration
public IComponent CreateInstance(Type componentType)Parameters
| Type | Name | Description | 
|---|---|---|
| Type | componentType | 
Returns
| Type | Description | 
|---|---|
| IComponent | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentException | 
Override(Type, Type)
Replaces the specified component type with another.
Declaration
public void Override(Type original, Type @override)Parameters
| Type | Name | Description | 
|---|---|---|
| Type | original | |
| Type | override | 
Override<TOriginal, TOverride>()
Replaces the specified component type with another.
Declaration
public void Override<TOriginal, TOverride>()Type Parameters
| Name | Description | 
|---|---|
| TOriginal | |
| TOverride |