如何从ItemDragEventArgs
获取目的地点?使用Microsoft.Windows.DragEventArgs e
很容易:e.GetPosition(<UIElement to which the point is relative to>)
XAML
<toolkit:PanelDragDropTarget AllowDrop="True" ItemDroppedOnTarget="DragAndDrop_ItemDroppedOnTarget">
代码
private void DragAndDrop_ItemDroppedOnTarget(object sender, ItemDragEventArgs e)
{
// how to get the destination Point here??
}
答案 0 :(得分:0)
这看起来像一个黑客,但它起作用并且非常准确:
private Point _releasePoint;
public Grid()
{
Grid.MouseLeftButtonUp += new MouseButtonEventHandler(Grid_MouseLeftButtonUp);
}
void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
_releasePoint = e.GetPosition(Grid);
}
private void DragAndDrop_ItemDroppedOnTarget(object sender, ItemDragEventArgs e)
{
// fires next and _releasePoint is already set
}