Answers for "Window Dimensions in Blazor?"

C#
1

Window Dimensions in Blazor?

using Microsoft.JSInterop;
using System.Threading.Tasks;

public class BrowserService
{
	private readonly IJSRuntime _js;

	public BrowserService(IJSRuntime js)
	{
		_js = js;
	}

	public async Task<BrowserDimension> GetDimensions()
	{
		return await _js.InvokeAsync<BrowserDimension>("getDimensions");
	}

}

public class BrowserDimension
{
	public int Width { get; set; }
	public int Height { get; set; }
}
Posted by: Guest on December-20-2020

Code answers related to "Window Dimensions in Blazor?"

C# Answers by Framework

Browse Popular Code Answers by Language