mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Add 'src/modules/launcher/' from commit '28acd466b352a807910cebbc74477d3173b31511'
git-subtree-dir: src/modules/launcher git-subtree-mainline:852689b3dfgit-subtree-split:28acd466b3
This commit is contained in:
50
src/modules/launcher/Wox/ResultListBox.xaml.cs
Normal file
50
src/modules/launcher/Wox/ResultListBox.xaml.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Wox
|
||||
{
|
||||
[Synchronization]
|
||||
public partial class ResultListBox
|
||||
{
|
||||
private Point _lastpos;
|
||||
private ListBoxItem curItem = null;
|
||||
public ResultListBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.AddedItems.Count > 0 && e.AddedItems[0] != null)
|
||||
{
|
||||
ScrollIntoView(e.AddedItems[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
curItem = (ListBoxItem)sender;
|
||||
var p = e.GetPosition((IInputElement)sender);
|
||||
_lastpos = p;
|
||||
}
|
||||
|
||||
private void OnMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
var p = e.GetPosition((IInputElement)sender);
|
||||
if (_lastpos != p)
|
||||
{
|
||||
((ListBoxItem) sender).IsSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ListBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (curItem != null)
|
||||
{
|
||||
curItem.IsSelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user