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
    object
    ComponentBase
    RadzenMediaQuery
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.BuildRenderTree(RenderTreeBuilder)
    ComponentBase.OnInitialized()
    ComponentBase.OnInitializedAsync()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.StateHasChanged()
    ComponentBase.ShouldRender()
    ComponentBase.OnAfterRender(bool)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.SetParametersAsync(ParameterView)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenMediaQuery : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    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()

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

    Declaration
    public RadzenMediaQuery()
    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
    [Parameter]
    public EventCallback<bool> Change { get; set; }
    Property Value
    Type Description
    EventCallback<bool>

    Query

    The CSS media query this component will listen for.

    Declaration
    [Parameter]
    public string Query { get; set; }
    Property Value
    Type Description
    string

    Methods

    Dispose()

    Detaches client-side event listeners.

    Declaration
    public void Dispose()

    OnAfterRenderAsync(bool)

    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
    Overrides
    ComponentBase.OnAfterRenderAsync(bool)

    OnChange(bool)

    Invoked by interop when media query changes.

    Declaration
    [JSInvokable]
    public Task OnChange(bool matches)
    Parameters
    Type Name Description
    bool matches
    Returns
    Type Description
    Task

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    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