Table of Contents

Class RadzenComponent

Namespace
Radzen
Assembly
Radzen.Blazor.dll

Base class of Radzen Blazor components.

public class RadzenComponent : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Inheritance
RadzenComponent
Implements
Derived
Inherited Members

Constructors

RadzenComponent()

public RadzenComponent()

Properties

Attributes

Specifies additional custom attributes that will be rendered by the component.

[Parameter(CaptureUnmatchedValues = true)]
public IReadOnlyDictionary<string, object> Attributes { get; set; }

Property Value

IReadOnlyDictionary<string, object>

The attributes.

ContextMenu

A callback that will be invoked when the user right-clicks the component. Commonly used to display a context menu via Open(MouseEventArgs, IEnumerable<ContextMenuItem>, Action<MenuItemEventArgs>).

[Parameter]
public EventCallback<MouseEventArgs> ContextMenu { get; set; }

Property Value

EventCallback<MouseEventArgs>

Culture

Gets or sets the culture used to display localizable data (numbers, dates). Set by default to CurrentCulture.

[Parameter]
public CultureInfo Culture { get; set; }

Property Value

CultureInfo

CurrentStyle

Gets the current style as a dictionary.

protected IDictionary<string, string> CurrentStyle { get; }

Property Value

IDictionary<string, string>

The current style as a dictionary of keys and values.

DefaultCulture

Gets or sets the culture set by a parent component.

[CascadingParameter(Name = "DefaultCulture")]
public CultureInfo DefaultCulture { get; set; }

Property Value

CultureInfo

Element

Gets a reference to the HTML element rendered by the component.

public ElementReference Element { get; protected set; }

Property Value

ElementReference

IsJSRuntimeAvailable

Gets or sets a value indicating whether JSRuntime is available.

protected bool IsJSRuntimeAvailable { get; set; }

Property Value

bool

JSRuntime

Gets or sets the js runtime.

[Inject]
protected IJSRuntime JSRuntime { get; set; }

Property Value

IJSRuntime

The js runtime.

MouseEnter

A callback that will be invoked when the user hovers the component. Commonly used to display a tooltip via Open(ElementReference, string, TooltipOptions).

[Parameter]
public EventCallback<ElementReference> MouseEnter { get; set; }

Property Value

EventCallback<ElementReference>

MouseLeave

A callback that will be invoked when the user moves the mouse out of the component. Commonly used to hide a tooltip via Close().

[Parameter]
public EventCallback<ElementReference> MouseLeave { get; set; }

Property Value

EventCallback<ElementReference>

Reference

Gets the reference for the current component.

protected DotNetObjectReference<RadzenComponent> Reference { get; }

Property Value

DotNetObjectReference<RadzenComponent>

The reference.

Style

Gets or sets the inline CSS style.

[Parameter]
public virtual string Style { get; set; }

Property Value

string

The style.

UniqueID

Gets or sets the unique identifier.

public string UniqueID { get; set; }

Property Value

string

The unique identifier.

Visible

Gets or sets a value indicating whether this RadzenComponent is visible. Invisible components are not rendered.

[Parameter]
public virtual bool Visible { get; set; }

Property Value

bool

true if visible; otherwise, false.

Methods

Debounce(Func<Task>, int)

Debounces the specified action.

protected void Debounce(Func<Task> action, int milliseconds = 500)

Parameters

action Func<Task>

The action.

milliseconds int

The milliseconds.

Dispose()

Detaches event handlers and disposes Reference.

public virtual void Dispose()

GetComponentCssClass()

Gets the component CSS class.

protected virtual string GetComponentCssClass()

Returns

string

GetCssClass()

Gets the final CSS class rendered by the component. Combines it with a class custom attribute.

protected string GetCssClass()

Returns

string

GetId()

Gets the unique identifier.

protected virtual string GetId()

Returns

string

Returns the id attribute (if specified) or generates a random one.

OnAfterRenderAsync(bool)

Called by the Blazor runtime.

protected override Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender bool

Returns

Task

OnContextMenu(MouseEventArgs)

Raises ContextMenu.

public virtual Task OnContextMenu(MouseEventArgs args)

Parameters

args MouseEventArgs

The MouseEventArgs instance containing the event data.

Returns

Task

OnInitialized()

Called by the Blazor runtime.

protected override void OnInitialized()

OnMouseEnter()

Raises MouseEnter.

public Task OnMouseEnter()

Returns

Task

OnMouseLeave()

Raises MouseLeave.

public Task OnMouseLeave()

Returns

Task

RaiseContextMenu(MouseEventArgs)

Invoked via interop when the browser "oncontextmenu" event is raised for this component.

[JSInvokable("RadzenComponent.RaiseContextMenu")]
public Task RaiseContextMenu(MouseEventArgs e)

Parameters

e MouseEventArgs

The MouseEventArgs instance containing the event data.

Returns

Task

RaiseMouseEnter()

Invoked via interop when the browser "onmouseenter" event is raised for this component.

[JSInvokable("RadzenComponent.RaiseMouseEnter")]
public Task RaiseMouseEnter()

Returns

Task

RaiseMouseLeave()

Invoked via interop when the browser "onmouseleave" event is raised for this component.

[JSInvokable("RadzenComponent.RaiseMouseLeave")]
public Task RaiseMouseLeave()

Returns

Task

SetParametersAsync(ParameterView)

Called by the Blazor runtime when parameters are set.

public override Task SetParametersAsync(ParameterView parameters)

Parameters

parameters ParameterView

The parameters.

Returns

Task