Skip to content

Commit 4e37a10

Browse files
committed
Revert selection if failed to set theme
1 parent dc3d2be commit 4e37a10

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ public ThemeData SelectedTheme
4040
set
4141
{
4242
_selectedTheme = value;
43-
App.API.SetCurrentTheme(value);
43+
if (!App.API.SetCurrentTheme(value))
44+
{
45+
// Revert selection if failed to set theme
46+
OnPropertyChanged();
47+
}
4448

4549
// Update UI state
4650
OnPropertyChanged(nameof(BackdropType));

Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432
ItemsSource="{Binding Themes}"
433433
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
434434
ScrollViewer.VerticalScrollBarVisibility="Disabled"
435-
SelectedValue="{Binding SelectedTheme}"
435+
SelectedValue="{Binding SelectedTheme, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
436436
Style="{DynamicResource ThemeListStyle}">
437437
<ListBox.ItemsPanel>
438438
<ItemsPanelTemplate>

0 commit comments

Comments
 (0)