From 7add40ae937f93d963e6d84718cf9dd427e069b1 Mon Sep 17 00:00:00 2001 From: ryanbodrug-microsoft <56318517+ryanbodrug-microsoft@users.noreply.github.com> Date: Thu, 23 Apr 2020 18:32:18 -0700 Subject: [PATCH] Adding back binding to QueryText and updating the cursor position similar to how wox originally did it. --- src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml | 1 + src/modules/launcher/PowerLauncher/MainWindow.xaml.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml b/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml index 6db4be5db7..2784345c4c 100644 --- a/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml +++ b/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml @@ -375,6 +375,7 @@ x:FieldModifier="public" Style="{StaticResource CustomAutoSuggestBoxTextBoxStyle}" PlaceholderText="Start typing" + Text="{Binding QueryText}" Height="60" ScrollViewer.BringIntoViewOnFocusChange="False" Canvas.ZIndex="0" diff --git a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs index 6bf9a00747..7c7cc62477 100644 --- a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs +++ b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs @@ -354,6 +354,12 @@ namespace PowerLauncher { _launcher.AutoCompleteTextBox.PlaceholderText = String.Empty; } + + if (_viewModel.QueryTextCursorMovedToEnd) + { + _launcher.TextBox.SelectionStart = _launcher.TextBox.Text.Length; + _viewModel.QueryTextCursorMovedToEnd = false; + } } private async Task DelayedCheck(DateTime latestTimeOfTyping, string text)