private VisualTheme GetThemeFromId(string id) { var comparer = StringComparer.OrdinalIgnoreCase; var match = ThemesView.Select(x => x as VisualTheme).FirstOrDefault(x => comparer.Equals(x.ThemeId, id)); return(match); }
private void SelectFromId(string id) { if (!string.IsNullOrWhiteSpace(id)) { var match = GetThemeFromId(id); if (match != null) { ThemesView.MoveCurrentTo(match); } } }
public VisualThemeSelector() { _themes = new List <VisualTheme>(); Fill(); var source = new CollectionViewSource() { Source = _themes }; ThemesView = source.View; ThemesView.CurrentChanged += ThemesView_CurrentChanged; // SystemUI = new UISettings(); SystemUI.ColorValuesChanged += SystemThemeChanged; //Select here from settings: ThemesView.MoveCurrentToFirst(); // }
public VisualThemeSelector( IServiceProvider serviceProvider , WindowsSettingsViewModel settingsViewModel , ResourceDictionary resources) { ServiceProvider = serviceProvider; Resources = resources; _settingsViewModel = settingsViewModel; _settingsViewModel.PropertyChanged += SettingsViewModelOnPropertyChanged; _themes = new List <VisualTheme>(); Fill(); var source = new CollectionViewSource() { Source = _themes }; ThemesView = source.View; ThemesView.CurrentChanged += ThemesView_CurrentChanged; // SystemUI = new UISettings(); SystemUI.ColorValuesChanged += SystemThemeChanged; //Select here from settings: if (string.IsNullOrWhiteSpace(_settingsViewModel.CustomThemeId)) { ThemesView.MoveCurrentToFirst(); } else { SelectFromId(_settingsViewModel.CustomThemeId); } // }