rungwiroon / BlazorGoogleMaps

Blazor interop for GoogleMap library
MIT License
329 stars 105 forks source link

Setting ColorScheme to Light at runtime doesn't work #381

Open poteb opened 4 hours ago

poteb commented 4 hours ago

Startup ColorScheme is set to ColorScheme.Light. I have a toggle switch that changes my site to dark mode. I update the map to dark mode like this:

_map1.InteropObject.SetOptions(new MapOptions{ColorScheme = b ? ColorScheme.Dark : ColorScheme.Light});

This works fine. But when I want to change it back to light mode nothing happens.

poteb commented 4 hours ago

More code that shows how I have checked that the value of b is indeed changing.

DarkModeHandler.AddListener(b =>
{
    Console.WriteLine($"Setting color scheme to {(b ? "dark" : "light")}");
    _map1.InteropObject.SetOptions(new MapOptions{ColorScheme = b ? ColorScheme.Dark : ColorScheme.Light});
});

DarkModeHandler is my own class where the switch changes the value.