blazorblazor-webassemblyblazorgooglemaps

How do I change a BlazorGoogleMaps GoogleMaps component's MapTypeId programmatically?


I want to provide a way for the user to change the page's GoogleMaps component's MapTypeId with a few buttons. I am using Blazor WASM. How do I do that?

I'm using MudBlazor components, so I would greatly appreciate an example using that.

I set up my project according to the project's readme, and I was able to create a GoogleMap component with any of the available MapTypeIds, but when I changed it, nothing happened.


Solution

  • Based on this answer, I was able to solve this problem. The relevant code part that helped:

    await map.InteropObject.SetMapTypeId(MapTypeId.Satellite);