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