Merge pull request #1380 from Sparrkle/QueryTextboxNotify

Fixed QueryTextbox Binding event
This commit is contained in:
Kevin Zhang 2022-09-30 21:25:32 -05:00 committed by GitHub
commit 1546f63897
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -174,6 +174,7 @@
PreviewDragOver="OnPreviewDragOver"
Style="{DynamicResource QueryBoxStyle}"
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PreviewKeyUp="QueryTextBox_KeyUp"
Visibility="Visible">
<TextBox.CommandBindings>
<CommandBinding Command="ApplicationCommands.Copy" Executed="OnCopy" />

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
@ -20,6 +20,8 @@ using Flow.Launcher.Infrastructure;
using System.Windows.Media;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Plugin.SharedCommands;
using System.Windows.Data;
using System.Diagnostics;
namespace Flow.Launcher
{
@ -555,5 +557,14 @@ namespace Flow.Launcher
ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Dark;
}
}
private void QueryTextBox_KeyUp(object sender, KeyEventArgs e)
{
if(_viewModel.QueryText != QueryTextBox.Text)
{
BindingExpression be = QueryTextBox.GetBindingExpression(System.Windows.Controls.TextBox.TextProperty);
be.UpdateSource();
}
}
}
}
}