RadzenMediaQuery Class

RadzenMediaQuery fires its Change event when the media query specified via Query matches or not.

Inheritance

Object

ComponentBase

RadzenMediaQuery

Implements

IComponent

IHandleEvent

IHandleAfterRender

Inherited Members

ComponentBase.BuildRenderTree

ComponentBase.OnInitialized

ComponentBase.OnInitializedAsync

ComponentBase.OnParametersSet

ComponentBase.OnParametersSetAsync

ComponentBase.StateHasChanged

ComponentBase.ShouldRender

ComponentBase.OnAfterRender

ComponentBase.InvokeAsync

ComponentBase.DispatchExceptionAsync

ComponentBase.SetParametersAsync

ComponentBase.RendererInfo

ComponentBase.Assets

ComponentBase.AssignedRenderMode

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenMediaQuery : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender

Examples

< RadzenMediaQuery Query="(max-width: 768px)" Change=@OnChange /> @code { void OnChange(bool matches) { // matches is true if the media query applies; otherwise false. } }

Constructors

RadzenMediaQuerylink

RadzenMediaQuery fires its Change event when the media query specified via Query matches or not.

Declaration
public RadzenMediaQuery()

Properties

Changelink

A callback that will be invoked when the status of the media query changes - to either match or not.

Declaration
public EventCallback<bool> Change { get; set; }
Property Value
Type Description
EventCallback<bool>A callback that will be invoked when the status of the media query changes - to either match or not.

Querylink

The CSS media query this component will listen for.

Declaration
public string Query { get; set; }
Property Value
Type Description
stringThe CSS media query this component will listen for.

Methods

Disposelink

Detaches client-side event listeners.

Declaration
public void Dispose()

OnAfterRenderAsynclink

Called by the Blazor runtime. Initializes the media query on the client-side.

Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type Name Description
bool firstRender
Returns
Type Description
Task

OnChangelink

Invoked by interop when media query changes.

Declaration
public Task OnChange(bool matches)
Parameters
Type Name Description
bool matches
Returns
Type Description
Task
An error has occurred. This app may no longer respond until reloaded. Reload 🗙