Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Hi!
I'm building an application where the user can switch between light and dark modes, but I can't make StockChart to rerender with the updated theme.
My component:
<SfStockChart Theme=@Theme @ref=@Chart>
...
</SfStockChart>
@code
{
SfStockChart Chart;
[Inject]
public ThemeService ThemeService { get; set; }
private Theme Theme { get; set; }
protected override void OnInitialized()
{
Theme = ThemeService.RenderedTheme == "light" ? Theme.Material : Theme.MaterialDark;
ThemeService.ChangeEvent += OnThemeChange;
}
private async Task OnThemeChange()
{
Theme = ThemeService.RenderedTheme == "light" ? Theme.Material : Theme.MaterialDark;
await InvokeAsync(() => { StateHasChanged(); });
}
}
But after the theme change the chart does not update.
Thanks for the help.