コード例 #1
0
ファイル: DropBehavior.cs プロジェクト: white777777/PhotoBox
        private void AssociatedObjectOnDrop(object sender, DragEventArgs dragEventArgs)
        {
            if (_dataType != null)
            {
                if (dragEventArgs.Data.GetDataPresent(_dataType))
                {
                    IDropable target = this.AssociatedObject.DataContext as IDropable;
                    if (target != null)
                    {
                        IDragable source = dragEventArgs.Data.GetData(_dataType) as IDragable;
                        if (source != null)
                        {
                            Debug.WriteLine("Drop");
                            Point currentPosition = dragEventArgs.GetPosition(RelativeElement);
                            source.Update(currentPosition.X, currentPosition.Y);
                        }

                        //target.Drop(dragEventArgs.Data.GetData(_dataType));
                    }
                }
            }

            dragEventArgs.Handled = true;
        }