Class RadzenMediaQuery
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