Skip to content

Commit 4dcb35e

Browse files
committed
Convert SelectedTheme from string to record
1 parent aedb2d4 commit 4dcb35e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ public partial class SettingsPaneThemeViewModel : BaseModel
2727
public static string LinkHowToCreateTheme => @"https://flowlauncher.com/docs/#/how-to-create-a-theme";
2828
public static string LinkThemeGallery => "https://github.com/Flow-Launcher/Flow.Launcher/discussions/1438";
2929

30-
public string SelectedTheme
30+
private Theme.ThemeData _selectedTheme;
31+
public Theme.ThemeData SelectedTheme
3132
{
32-
get => Settings.Theme;
33+
get => _selectedTheme ??= Themes.Find(v => v.FileNameWithoutExtension == Settings.Theme);
3334
set
3435
{
35-
ThemeManager.Instance.ChangeTheme(value);
36+
_selectedTheme = value;
37+
ThemeManager.Instance.ChangeTheme(value.FileNameWithoutExtension);
3638

3739
if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect)
3840
DropShadowEffect = false;

Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,7 @@
401401
ItemsSource="{Binding Themes}"
402402
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
403403
ScrollViewer.VerticalScrollBarVisibility="Auto"
404-
SelectedValue="{Binding SelectedTheme}"
405-
SelectedValuePath="FileNameWithoutExtension">
404+
SelectedValue="{Binding SelectedTheme}">
406405
<ListBox.ItemsPanel>
407406
<ItemsPanelTemplate>
408407
<WrapPanel />

0 commit comments

Comments
 (0)