WPF does not automatically get the default APP Mode, you can implement it yourself. The value of default app mode corresponds to the value of AppsUseLightTheme which is in Registry Key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme. You can use the below code to get the value. In my Registry , the value of Light mode is 1.
var v = Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", "1");
Then declare the themes referring to SystemColors
public enum AppTheme
{
Light,
Dark
}
Then use it like below:
this.Resources.MergedDictionaries[0].Source =new Uri($"/Themes/{appTheme}.xaml", UriKind.Relative);