Table of Contents

Class EventUtil

Namespace
MudBlazor
Assembly
MudBlazor.dll

Utility class for opting out of rerendering in Blazor when an EventCallback is invoked. By default, components inherit from ComponentBase, which automatically invokes StateHasChanged after the component's event handlers are invoked. In some cases, it might be unnecessary or undesirable to trigger a rerender after an event handler is invoked. For example, an event handler might not modify the component state. https://learn.microsoft.com/en-us/aspnet/core/blazor/performance?view=aspnetcore-6.0#avoid-rerendering-after-handling-events-without-state-changes

public static class EventUtil
Inheritance
EventUtil
Inherited Members

Methods

AsNonRenderingEventHandler(Action)

Converts the provided Action callback into a non-rendering event handler.

public static Action AsNonRenderingEventHandler(Action callback)

Parameters

callback Action

The action callback to be converted.

Returns

Action

A non-rendering event handler.

AsNonRenderingEventHandler(Func<Task>)

Converts the provided Func<TResult> callback into a non-rendering event handler.

public static Func<Task> AsNonRenderingEventHandler(Func<Task> callback)

Parameters

callback Func<Task>

The asynchronous callback to be converted.

Returns

Func<Task>

A non-rendering event handler.

AsNonRenderingEventHandler<TValue>(Action<TValue>)

Converts the provided Action<T> callback into a non-rendering event handler.

public static Action<TValue> AsNonRenderingEventHandler<TValue>(Action<TValue> callback)

Parameters

callback Action<TValue>

The action callback to be converted.

Returns

Action<TValue>

A non-rendering event handler.

Type Parameters

TValue

The type of the callback argument.

AsNonRenderingEventHandler<TValue>(Func<TValue, Task>)

Converts the provided Func<T, TResult> callback into a non-rendering event handler.

public static Func<TValue, Task> AsNonRenderingEventHandler<TValue>(Func<TValue, Task> callback)

Parameters

callback Func<TValue, Task>

The asynchronous callback to be converted.

Returns

Func<TValue, Task>

A non-rendering event handler.

Type Parameters

TValue

The type of the callback argument.