mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Fix textbox keyboard focusing
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBox Style="{DynamicResource QueryBoxStyle}" Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
PreviewDragOver="TbQuery_OnPreviewDragOver" AllowDrop="True"
|
||||
x:Name="tbQuery" />
|
||||
x:Name="QueryTextBox" />
|
||||
<Line Style="{DynamicResource PendingLineStyle}" x:Name="progressBar" Y1="0" Y2="0" X2="100" Height="2" StrokeThickness="1"
|
||||
Visibility="{Binding ProgressBarVisibility}">
|
||||
<Line.ToolTip>
|
||||
|
||||
@@ -58,12 +58,12 @@ namespace Wox
|
||||
{
|
||||
if (vm.SelectAllText)
|
||||
{
|
||||
tbQuery.SelectAll();
|
||||
QueryTextBox.SelectAll();
|
||||
}
|
||||
}
|
||||
else if(eve.PropertyName == "CaretIndex")
|
||||
{
|
||||
tbQuery.CaretIndex = vm.CaretIndex;
|
||||
QueryTextBox.CaretIndex = vm.CaretIndex;
|
||||
}
|
||||
else if(eve.PropertyName == "Left")
|
||||
{
|
||||
@@ -73,20 +73,19 @@ namespace Wox
|
||||
{
|
||||
Top = vm.Top;
|
||||
}
|
||||
else if(eve.PropertyName == "IsVisible")
|
||||
else if(eve.PropertyName == "MainWindowVisibility")
|
||||
{
|
||||
if (vm.MainWindowVisibility.IsVisible())
|
||||
{
|
||||
tbQuery.Focus();
|
||||
Activate();
|
||||
QueryTextBox.Focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
vm.Left = GetWindowsLeft();
|
||||
vm.Top = GetWindowsTop();
|
||||
Activate();
|
||||
Focus();
|
||||
tbQuery.Focus();
|
||||
vm.MainWindowVisibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private double GetWindowsLeft()
|
||||
@@ -105,7 +104,7 @@ namespace Wox
|
||||
|
||||
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||
var dipPoint = WindowIntelopHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Height);
|
||||
UserSettingStorage.Instance.WindowTop = (dipPoint.Y - tbQuery.ActualHeight)/4;
|
||||
UserSettingStorage.Instance.WindowTop = (dipPoint.Y - QueryTextBox.ActualHeight)/4;
|
||||
return UserSettingStorage.Instance.WindowTop;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user