Table of Contents

Class SystemThemeWatcher

Namespace
Wpf.Ui.Appearance
Assembly
Wpf.Ui.dll

Automatically updates the application background if the system theme or color is changed.

SystemThemeWatcher settings work globally and cannot be changed for each Window.

public static class SystemThemeWatcher
Inheritance
SystemThemeWatcher
Inherited Members

Examples

SystemThemeWatcher.Watch(this as System.Windows.Window);
SystemThemeWatcher.UnWatch(this as System.Windows.Window);
SystemThemeWatcher.Watch(
    _serviceProvider.GetRequiredService<MainWindow>()
);

Methods

UnWatch(Window?)

Unwatches the window and removes the hook to receive messages from the system.

public static void UnWatch(Window? window)

Parameters

window Window

Watch(Window?, WindowBackdropType, bool)

Watches the Window and applies the background effect and theme according to the system theme.

public static void Watch(Window? window, WindowBackdropType backdrop = WindowBackdropType.Mica, bool updateAccents = true)

Parameters

window Window

The window that will be updated.

backdrop WindowBackdropType

Background effect to be applied when changing the theme.

updateAccents bool

If true, the accents will be updated when the change is detected.