Initial commit

This commit is contained in:
Garulf 2021-12-04 03:51:21 -05:00
parent 09e10c4ce8
commit 846333af1e
3 changed files with 15 additions and 10 deletions

View file

@ -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;

View file

@ -161,7 +161,8 @@
Style="{DynamicResource QuerySuggestionBoxStyle}">
<TextBox.Text>
<MultiBinding Converter="{StaticResource QuerySuggestionBoxConverter}">
<Binding ElementName="QueryTextBox" Path="Text" />
<Binding RelativeSource="{RelativeSource self}" Mode="OneTime" />
<Binding ElementName="QueryTextBox" Mode="OneTime" />
<Binding ElementName="ResultListBox" Path="SelectedItem" />
</MultiBinding>
</TextBox.Text>
@ -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">
<TextBox.ContextMenu>
<ContextMenu>
<MenuItem Command="ApplicationCommands.Cut" />

View file

@ -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()