Table of Contents

Class RadzenMediaQuery

Namespace
Radzen.Blazor
Assembly
Radzen.Blazor.dll

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

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

Examples

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

Constructors

RadzenMediaQuery()

public RadzenMediaQuery()

Properties

Change

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

[Parameter]
public EventCallback<bool> Change { get; set; }

Property Value

EventCallback<bool>

Query

The CSS media query this component will listen for.

[Parameter]
public string Query { get; set; }

Property Value

string

Methods

Dispose()

Detaches client-side event listeners.

public void Dispose()

OnAfterRenderAsync(bool)

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

protected override Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender bool

Returns

Task

OnChange(bool)

Invoked by interop when media query changes.

[JSInvokable]
public Task OnChange(bool matches)

Parameters

matches bool

Returns

Task