Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class RadzenMediaQuery

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

    Inheritance
    System.Object
    RadzenMediaQuery
    Implements
    IDisposable
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenMediaQuery : ComponentBase, IDisposable
    Examples

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

    Properties

    Change

    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<System.Boolean>

    Query

    The CSS media query this component will listen for.

    Declaration
    public string Query { get; set; }
    Property Value
    Type Description
    System.String

    Methods

    Dispose()

    Detaches client-side event listeners.

    Declaration
    public void Dispose()

    OnAfterRenderAsync(Boolean)

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

    Declaration
    protected override async Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender
    Returns
    Type Description
    Task

    OnChange(Boolean)

    Invoked by interop when media query changes.

    Declaration
    public async Task OnChange(bool matches)
    Parameters
    Type Name Description
    System.Boolean matches
    Returns
    Type Description
    Task

    Implements

    IDisposable

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT