mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 20:57:22 +02:00
Add drop event [WIP]
This commit is contained in:
@@ -16,6 +16,7 @@ namespace Wox
|
||||
{
|
||||
public event Action<Result> LeftMouseClickEvent;
|
||||
public event Action<Result> RightMouseClickEvent;
|
||||
public event Action<Result,IDataObject> ItemDropEvent;
|
||||
|
||||
protected virtual void OnRightMouseClick(Result result)
|
||||
{
|
||||
@@ -208,5 +209,20 @@ namespace Wox
|
||||
}
|
||||
Select(index);
|
||||
}
|
||||
|
||||
private void ListBoxItem_OnDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
var item = ItemsControl.ContainerFromElement(lbResults, e.OriginalSource as DependencyObject) as ListBoxItem;
|
||||
if (item != null)
|
||||
{
|
||||
OnItemDropEvent(item.DataContext as Result,e.Data);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnItemDropEvent(Result obj, IDataObject data)
|
||||
{
|
||||
var handler = ItemDropEvent;
|
||||
if (handler != null) handler(obj,data);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user