Skip to content

Commit 15b8747

Browse files
committed
Fix IsEnabled binding for suggestion combobox
1 parent 4ae58c8 commit 15b8747

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ namespace Flow.Launcher.Plugin.WebSearch
77
{
88
public class Settings : BaseModel
99
{
10+
private bool enableSuggestion;
11+
1012
public Settings()
1113
{
1214
SelectedSuggestion = Suggestions[0];
@@ -191,7 +193,15 @@ public Settings()
191193
[JsonIgnore]
192194
public SearchSource SelectedSearchSource { get; set; }
193195

194-
public bool EnableSuggestion { get; set; }
196+
public bool EnableSuggestion
197+
{
198+
get => enableSuggestion;
199+
set
200+
{
201+
enableSuggestion = value;
202+
OnPropertyChanged(nameof(EnableSuggestion));
203+
}
204+
}
195205

196206
[JsonIgnore]
197207
public SuggestionSource[] Suggestions { get; set; } = {

Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
Margin="{StaticResource SettingPanelItemLeftMargin}"
139139
VerticalAlignment="Center"
140140
FontSize="11"
141-
IsEnabled="{Binding ElementName=EnableSuggestion, Path=IsChecked}"
141+
IsEnabled="{Binding Settings.EnableSuggestion}"
142142
ItemsSource="{Binding Settings.Suggestions}"
143143
SelectedItem="{Binding Settings.SelectedSuggestion}" />
144144
<CheckBox
@@ -149,7 +149,6 @@
149149
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}"
150150
IsChecked="{Binding Settings.EnableSuggestion}" />
151151
</StackPanel>
152-
<!-- Not sure why binding IsEnabled directly to Settings.EnableWebSearchSuggestion is not working -->
153152
</DockPanel>
154153
</Grid>
155154
</UserControl>

Plugins/Flow.Launcher.Plugin.WebSearch/setting.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,6 @@
141141
"Enabled": true
142142
}
143143
],
144-
"EnableWebSearchSuggestion": false,
145-
"WebSearchSuggestionSource": "Google"
144+
"EnableSuggestion": false,
145+
"Suggestion": "Google"
146146
}

0 commit comments

Comments
 (0)