-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
I am using the dynamic ability of Blazor to set the style for divs, buttons etc instead of css files. This is handy because it allows my site designer to set the style for the major properties that determine look and feel such as color from the gui.
The issue is that after a change of the values, it doesn't refresh in the Templates.
My project is about 30,000 lines of code so I don't want to include it, but I can show a few code snippets that shows what is (not) happening.
In this code sample I am forcing a call to AppState_OnChanged() in order to have the StateHasChanged() called on the index page. StateHasChanged is also being called just as the Dialog exits.
The SelectedPageNav has not actually changed.
If this code is set on the Index page then it will cause the refresh of the colors
` private void AppState_OnChange()
{
SelectedPageNav = AppState.SelectedPage;
ReverseStyleSetting = null;
StyleSetting = null;
MenuBackColor = null;
StateHasChanged();
ReverseStyleSetting = MyApplicationColorScheme.GetReverseBackgroundStyle();
StyleSetting = MyApplicationColorScheme.GetBackgroundStyle();
MenuBackColor = MyApplicationColorScheme.GetMenuBackground();
this.StateHasChanged();
}`
and here is an example of a style being assigned to one of them.
` div class="col-sm-12 col-md-10 col-lg 9" style="@StyleSetting"
However, I can find no work around to make the StateHasChanged refresh the Templates that also have variable style settings.
Edit: It appears this bug is actually a feature as per #16291
Now that I understand that this is by design it makes sense.
.