Use one way binding for showing result hotkey

This commit is contained in:
Jack251970 2025-07-13 10:51:03 +08:00
parent b3d2fea6d8
commit c5373f6abf
2 changed files with 17 additions and 2 deletions

View file

@ -42,7 +42,21 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
public string ColorScheme { get; set; } = "System";
public bool ShowOpenResultHotkey { get; set; } = true;
private bool _showOpenResultHotkey = true;
public bool ShowOpenResultHotkey
{
get => _showOpenResultHotkey;
set
{
if (_showOpenResultHotkey != value)
{
_showOpenResultHotkey = value;
OnPropertyChanged();
}
}
}
public double WindowSize { get; set; } = 580;
public string PreviewHotkey { get; set; } = $"F1";
public string AutoCompleteHotkey { get; set; } = $"{KeyConstant.Ctrl} + Tab";

View file

@ -36,6 +36,7 @@
<converter:BadgePositionConverter x:Key="BadgePositionConverter" />
<converter:IconRadiusConverter x:Key="IconRadiusConverter" />
<converter:DiameterToCenterPointConverter x:Key="DiameterToCenterPointConverter" />
<converter:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
@ -66,7 +67,7 @@
Grid.Column="2"
Margin="0 0 10 0"
VerticalAlignment="Center"
Visibility="{Binding ShowOpenResultHotkey}">
Visibility="{Binding Settings.ShowOpenResultHotkey, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
<Border x:Name="HotkeyBG" Style="{DynamicResource ItemHotkeyBGStyle}">
<Border.Visibility>
<Binding Converter="{StaticResource ResourceKey=OpenResultHotkeyVisibilityConverter}" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}" />