mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
[PT Run] Fix some keyboard issues on plugin (#13490)
* Don't use enter for accelerator keys in results Enter is already used to select commands in the context menu in the result entries. * Don't crash when trying to show a tooltip * Clear hanging tooltips when keyboard navigating * Starting/stopping service on Enter
This commit is contained in:
@@ -58,14 +58,25 @@ namespace PowerLauncher
|
||||
if (listView.SelectedItem != null)
|
||||
{
|
||||
ListBoxItem listBoxItem = (ListBoxItem)listView.ItemContainerGenerator.ContainerFromItem(listView.SelectedItem);
|
||||
ContentPresenter contentPresenter = FindVisualChild<ContentPresenter>(listBoxItem);
|
||||
DataTemplate dataTemplate = contentPresenter.ContentTemplate;
|
||||
Button button = (Button)dataTemplate.FindName("commandButton", contentPresenter);
|
||||
ToolTip tooltip = button.ToolTip as ToolTip;
|
||||
tooltip.PlacementTarget = button;
|
||||
tooltip.Placement = System.Windows.Controls.Primitives.PlacementMode.Right;
|
||||
tooltip.PlacementRectangle = new Rect(0, button.Height, 0, 0);
|
||||
tooltip.IsOpen = true;
|
||||
if (listBoxItem != null)
|
||||
{
|
||||
ContentPresenter contentPresenter = FindVisualChild<ContentPresenter>(listBoxItem);
|
||||
DataTemplate dataTemplate = contentPresenter.ContentTemplate;
|
||||
Button button = (Button)dataTemplate.FindName("commandButton", contentPresenter);
|
||||
ToolTip tooltip = button.ToolTip as ToolTip;
|
||||
tooltip.PlacementTarget = button;
|
||||
tooltip.Placement = System.Windows.Controls.Primitives.PlacementMode.Right;
|
||||
tooltip.PlacementRectangle = new Rect(0, button.Height, 0, 0);
|
||||
tooltip.IsOpen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
HideCurrentToolTip();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HideCurrentToolTip();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user