Add drop event [WIP]

This commit is contained in:
qianlifeng
2015-02-02 23:28:40 +08:00
parent 5ef72b81ae
commit 95e468c90a
10 changed files with 199 additions and 157 deletions

View File

@@ -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);
}
}
}