1using System.Windows.Input;
2using CommunityToolkit.Mvvm.ComponentModel;
3using CommunityToolkit.Mvvm.Input;
21 private ICommand _setThemeCommand;
25 public ICommand
SetThemeCommand => _setThemeCommand ?? (_setThemeCommand =
new RelayCommand<string>(OnSetTheme));
35 _themeSelectorService = themeSelectorService;
41 Theme = _themeSelectorService.GetCurrentTheme();
49 private void OnSetTheme(
string themeName)
52 _themeSelectorService.SetTheme(theme);
SettingsViewModel(IThemeSelectorService themeSelectorService)
Constructor of the settings view model.
AppTheme _theme
App Theme (dark, light)
void OnNavigatedTo(object parameter)
OnNavigatedTo method to handle navigation to this object.
ICommand SetThemeCommand
Command to change the app theme.
void OnNavigatedFrom()
OnNavigatedFrom method to handle navigation away from this object.
Interface for a service to manage the application theme selection.
Interface for objects that need to handle navigation events.
AppTheme
Enumeration for the application theme.
@ Enum
Display an editor for an enumeration value.