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

[FluentDesignTheme] Add OnLoaded event #1156

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

dvoituron
Copy link
Collaborator

[FluentDesignTheme] Add OnLoaded event

Add an OnLoaded event raised when the component is rendered for the first time.
This event contains all properties initialized: Mode, IsDark, CustomColor, OfficeColor, StorageName, Direction.

Two new JavaScript properties are added: Blazor.theme.isDarkMode() and Blazor.theme.isSystemDark()

Example

<FluentDesignTheme OnLoaded="@OnLoaded"
                   OnLuminanceChanged="@OnLuminanceChanged" />

@code
{
    void OnLoaded(LoadedEventArgs e)
    {
        DemoLogger.WriteLine($"Loaded: {(e.Mode == DesignThemeModes.System ? "System" : "")} {(e.IsDark ? "Dark" : "Light")}");
    }

    void OnLuminanceChanged(LuminanceChangedEventArgs e)
    {
        DemoLogger.WriteLine($"Changed: {(e.Mode == DesignThemeModes.System ? "System" : "")} {(e.IsDark ? "Dark" : "Light")}");
    }
}

Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1156.westeurope.3.azurestaticapps.net

@vnbaaij vnbaaij merged commit 5460db9 into dev Dec 19, 2023
4 checks passed
@vnbaaij vnbaaij deleted the users/dvoituron/design-theme-startup branch December 19, 2023 09:01
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

Successfully merging this pull request may close these issues.

2 participants