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