Class RadzenMediaQuery
Inherited Members
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()
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
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 |