Convert SelectedTheme from string to record

This commit is contained in:
Yusyuriv 2024-06-02 22:35:58 +06:00
parent aedb2d4227
commit 4dcb35ee24
No known key found for this signature in database
GPG key ID: A91C52E6F73148E0
2 changed files with 6 additions and 5 deletions

View file

@ -27,12 +27,14 @@ public partial class SettingsPaneThemeViewModel : BaseModel
public static string LinkHowToCreateTheme => @"https://flowlauncher.com/docs/#/how-to-create-a-theme";
public static string LinkThemeGallery => "https://github.com/Flow-Launcher/Flow.Launcher/discussions/1438";
public string SelectedTheme
private Theme.ThemeData _selectedTheme;
public Theme.ThemeData SelectedTheme
{
get => Settings.Theme;
get => _selectedTheme ??= Themes.Find(v => v.FileNameWithoutExtension == Settings.Theme);
set
{
ThemeManager.Instance.ChangeTheme(value);
_selectedTheme = value;
ThemeManager.Instance.ChangeTheme(value.FileNameWithoutExtension);
if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect)
DropShadowEffect = false;

View file

@ -401,8 +401,7 @@
ItemsSource="{Binding Themes}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectedValue="{Binding SelectedTheme}"
SelectedValuePath="FileNameWithoutExtension">
SelectedValue="{Binding SelectedTheme}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />