Skip to content

Commit

Permalink
Update system-theme-watcher.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bayeggex authored Aug 14, 2024
1 parent 3131f19 commit 4d72674
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions docs/documentation/system-theme-watcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,40 +84,5 @@ private static IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam

```

## Setup

Before using SystemThemeWatcher, you need to add the relevant WPF UI resources to your application. To support theme changes, you can add the WPF UI resources to your `App.xaml` file as shown below:

```xml
<Application
...
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary Theme="Dark" />
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
```

Alternatively, you can add the resources manually:

```xml
<Application>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Resources/Theme/Dark.xaml" />
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Resources/Wpf.Ui.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

```

> [!IMPORTANT]
> If UnWatch is called on a window that has not yet loaded, an InvalidOperationException may occur. Ensure that the window is loaded before calling UnWatch.

0 comments on commit 4d72674

Please sign in to comment.