Use KeyBinding in xaml

This commit is contained in:
Vic 2022-12-23 00:58:26 +08:00
parent 33c0af1fab
commit f2101026c3
3 changed files with 8 additions and 5 deletions

View file

@ -181,6 +181,9 @@
Command="{Binding OpenResultCommand}"
CommandParameter="9"
Modifiers="{Binding OpenResultCommandModifiers}" />
<KeyBinding
Key="{Binding TogglePreviewHotkey}"
Command="{Binding TogglePreviewCommand}"/>
</Window.InputBindings>
<Grid>
<Border MouseDown="OnMouseDown" Style="{DynamicResource WindowBorderStyle}">

View file

@ -620,11 +620,6 @@ namespace Flow.Launcher
}
}
break;
case Key.F1:
PreviewToggle();
e.Handled = true;
break;
default:
break;

View file

@ -74,6 +74,9 @@ namespace Flow.Launcher.ViewModel
case nameof(Settings.AlwaysStartEn):
OnPropertyChanged(nameof(StartWithEnglishMode));
break;
case nameof(Settings.PreviewHotkey):
OnPropertyChanged(nameof(TogglePreviewHotkey));
break;
}
};
@ -570,6 +573,8 @@ namespace Flow.Launcher.ViewModel
public string OpenResultCommandModifiers { get; private set; }
public string TogglePreviewHotkey => Settings.PreviewHotkey; // TODO: is hotkey combo possible?
public string Image => Constant.QueryTextBoxIconImagePath;
public bool StartWithEnglishMode => Settings.AlwaysStartEn;