Fix IsEnabled binding for suggestion combobox

This commit is contained in:
zoltanvi 2025-08-09 11:51:12 +02:00
parent 4ae58c8890
commit 15b8747280
3 changed files with 14 additions and 5 deletions

View file

@ -7,6 +7,8 @@ namespace Flow.Launcher.Plugin.WebSearch
{
public class Settings : BaseModel
{
private bool enableSuggestion;
public Settings()
{
SelectedSuggestion = Suggestions[0];
@ -191,7 +193,15 @@ namespace Flow.Launcher.Plugin.WebSearch
[JsonIgnore]
public SearchSource SelectedSearchSource { get; set; }
public bool EnableSuggestion { get; set; }
public bool EnableSuggestion
{
get => enableSuggestion;
set
{
enableSuggestion = value;
OnPropertyChanged(nameof(EnableSuggestion));
}
}
[JsonIgnore]
public SuggestionSource[] Suggestions { get; set; } = {

View file

@ -138,7 +138,7 @@
Margin="{StaticResource SettingPanelItemLeftMargin}"
VerticalAlignment="Center"
FontSize="11"
IsEnabled="{Binding ElementName=EnableSuggestion, Path=IsChecked}"
IsEnabled="{Binding Settings.EnableSuggestion}"
ItemsSource="{Binding Settings.Suggestions}"
SelectedItem="{Binding Settings.SelectedSuggestion}" />
<CheckBox
@ -149,7 +149,6 @@
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}"
IsChecked="{Binding Settings.EnableSuggestion}" />
</StackPanel>
<!-- Not sure why binding IsEnabled directly to Settings.EnableWebSearchSuggestion is not working -->
</DockPanel>
</Grid>
</UserControl>

View file

@ -141,6 +141,6 @@
"Enabled": true
}
],
"EnableWebSearchSuggestion": false,
"WebSearchSuggestionSource": "Google"
"EnableSuggestion": false,
"Suggestion": "Google"
}