From 846333af1ef868c3f7f497d467ddd1b18dab2b16 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Sat, 4 Dec 2021 03:51:21 -0500 Subject: [PATCH] Initial commit --- .../Converters/QuerySuggestionBoxConverter.cs | 11 +++++++---- Flow.Launcher/MainWindow.xaml | 8 ++++---- Flow.Launcher/MainWindow.xaml.cs | 6 ++++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs index c70796a6d..3de95fe47 100644 --- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs +++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs @@ -1,5 +1,6 @@ using System; using System.Globalization; +using System.Windows.Controls; using System.Windows.Data; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.ViewModel; @@ -10,19 +11,21 @@ namespace Flow.Launcher.Converters { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { - if (values.Length != 2) + if (values.Length != 3) { return string.Empty; } - + var QueryText = values[1] as TextBox; + var Suggestion = values[0] as TextBox; + Suggestion.ScrollToHorizontalOffset(QueryText.HorizontalOffset); // first prop is the current query string - var queryText = (string)values[0]; + var queryText = QueryText.Text; if (string.IsNullOrEmpty(queryText)) return string.Empty; // second prop is the current selected item result - var val = values[1]; + var val = values[2]; if (val == null) { return string.Empty; diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 618cee609..b419c2092 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -161,7 +161,8 @@ Style="{DynamicResource QuerySuggestionBoxStyle}"> - + + @@ -171,10 +172,9 @@ AllowDrop="True" Background="Transparent" PreviewDragOver="OnPreviewDragOver" - Style="{DynamicResource QueryBoxStyle}" - SelectionChanged="TextBox_SelectionChanged" + Style="{DynamicResource QueryBoxStyle }" Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" - Visibility="Visible"> + Visibility="Visible" Margin="16,7,0,7"> diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 749f006c7..e2c443b12 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -262,10 +262,12 @@ namespace Flow.Launcher private void TextBox_SelectionChanged(object sender, RoutedEventArgs e) { - + // QueryTextSuggestionBox.ScrollToCaret(); - QueryTextSuggestionBox.ScrollToLine(QueryTextBox.GetLineIndexFromCharacterIndex(QueryTextBox.SelectionStart)); QueryTextSuggestionBox.CaretIndex = QueryTextBox.CaretIndex; + QueryTextSuggestionBox.ScrollToHorizontalOffset(QueryTextBox.HorizontalOffset); + + } public void WindowAnimator()