Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color pickers not working #8

Open
Alipoustdouzan opened this issue Jan 14, 2022 · 6 comments
Open

Color pickers not working #8

Alipoustdouzan opened this issue Jan 14, 2022 · 6 comments

Comments

@Alipoustdouzan
Copy link

Alipoustdouzan commented Jan 14, 2022

When i try to change colors in color pickers or change the RGB textbox, It doesn't change the color, Other settings work except colors.
My NuGet versions :

image

@pesik77
Copy link

pesik77 commented Jan 20, 2022

I'm facing same issue, but just when using client side blazor, otherwise is working correclty.

@Logi-Fy-Pravin
Copy link

I am facing the same !!

@hastiiFallah
Copy link

yes.im facing the same prob

@Alipoustdouzan
Copy link
Author

I'm facing same issue, but just when using client side blazor, otherwise is working correclty.

I created a Blazor Serverside project but still have this issue, Only for colors.

@Medioman92
Copy link

Same here, the picker shows up but it's not working.

@AnikeRU
Copy link

AnikeRU commented Jun 16, 2022

Check that the MudDialogProvider is exist only one time either in the App or in the Main Layout.

`#####################################################################
App.razor
###############################################################################
<MudThemeProvider Theme="@mudTheme" />
<MudDialogProvider />
<MudSnackbarProvider />

<CascadingValue Value="this">
<Router ...>
...
</Router>
</CascadingValue>

@code
{
    public EventCallback<MudTheme> ThemChanged;

    public MudTheme mudTheme = new MudTheme()
    {
        Palette = new Palette()
        {
            Primary = "#5D2E8F",
            AppbarBackground = "#5D2E8F",
        }
    };

    public App()
    {
       // Needs for autocalling StateHasChanged and changing to MUI theme.
        ThemChanged = new EventCallbackFactory().Create<MudTheme>(this, (e) => { mudTheme = e; });
    }
}
###############################################################################
MainLayout.razor
###############################################################################
    <MudLayout>
        <MudAppBar Elevation="2">
...
            <div class="d-none d-md-flex align-center">
                <MudSelect Class="mx-4"
                           Dense="true"
                           Label="Theme Manager Config"
                           Style="max-width: 250px; color: #fff;"
                           T="string"
                           Value="_themeManagerConfiguration.Key"
                           ValueChanged="ThemeManagerConfigChanged">
                    @foreach (var config in _themeManagerConfigurations)
                    {
                        <MudSelectItem T="string"
                                       Value="config.Key" />
                    }
                </MudSelect>
            </div>
        </MudAppBar>
...
        <MudThemeManager @bind-Open="_themeManagerOpen"
                    @bind-Theme="mudTheme"
                    Configuration="_themeManagerConfiguration.Value" />
        <MudThemeManagerButton OnClick="@(e => _themeManagerOpen = true)" />

        <MudMainContent Style="min-height: 100vh; display: flex; flex-direction: column">
            <MudContainer MaxWidth="MaxWidth.False" Style="flex: 1">
...
    </MudLayout>

@code {
    [CascadingParameter] App App { get; set; }

    protected readonly Dictionary<string, ThemeManagerConfiguration> _themeManagerConfigurations = new()
    {
        {"Preset One", ThemeManagerPresetConfigurations.GetPresetConfigOne()},
        {"Preset Two", ThemeManagerPresetConfigurations.GetPresetConfigTwo()}
    };

    public MudTheme mudTheme 
    {
        get => App.mudTheme;
        set { App.ThemChanged.InvokeAsync(value); }
    } 
    
    protected KeyValuePair<string, ThemeManagerConfiguration> _themeManagerConfiguration;

    protected bool _drawerOpen;
    protected bool _themeManagerOpen;

    protected void ThemeManagerConfigChanged(string key)
    {
        _themeManagerConfiguration = _themeManagerConfigurations.FirstOrDefault(x => x.Key == key);
    }

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants