private void Theme_SelectionChanged(object sender, SelectionChangedEventArgs e) { SettingSet.ThemeSettingSet(Theme.SelectedIndex); if (Theme.SelectedIndex == 0) { ((Frame)Window.Current.Content).RequestedTheme = ElementTheme.Light; } else { ((Frame)Window.Current.Content).RequestedTheme = ElementTheme.Dark; } }
/// <summary> /// 设置主题 /// </summary> private void ThemeToggleSwitch_Toggled(object sender, RoutedEventArgs e) { SettingSet.ThemeSettingSet(ThemeToggleSwitch.IsOn); ((Frame)Window.Current.Content).RequestedTheme = ThemeToggleSwitch.IsOn ? ElementTheme.Dark : ElementTheme.Light; }