Exemple #1
0
        protected override DragAndDropVisualMode HandleElementsDragAndDrop(DragAndDropArgs args, LayerTreeElement[] elements)
        {
            if (args.performDrop)
            {
                if (args.dragAndDropPosition == DragAndDropPosition.UponItem)
                {
                    if (args.parentItem is TreeViewItem <LayerTreeElement> layerTreeItem)
                    {
                        ItemsDropped?.Invoke(elements, layerTreeItem.Data);
                    }
                }
                Reload();
                return(DragAndDropVisualMode.None);
            }

            switch (args.dragAndDropPosition)
            {
            default: {
                return(DragAndDropVisualMode.None);
            }

            case DragAndDropPosition.BetweenItems:
            case DragAndDropPosition.OutsideItems: {
                return(DragAndDropVisualMode.Rejected);
            }

            case DragAndDropPosition.UponItem: {
                if (args.parentItem is TreeViewItem <LayerTreeElement> layerTreeItem)
                {
                    return(layerTreeItem.Data.Type == LayerTreeViewElementType.Layer ? DragAndDropVisualMode.Link : DragAndDropVisualMode.Rejected);
                }
                return(DragAndDropVisualMode.Move);
            }
            }
        }
Exemple #2
0
        private async void Row_Drop(object sender, DragEventArgs e)
        {
            var row = (Border)sender;
            var fse = (FileSystemElement)row.Tag;

            StyleHitbox(row, ROW_DEFAULT_STYLE_NAME);
            if (fse.IsFolder && e.DataView.Contains(StandardDataFormats.StorageItems))
            {
                var items = await e.DataView.GetStorageItemsAsync();

                ItemsDropped?.Invoke(fse, items);
                //FileSystem.MoveStorageItemsAsync(fse, items.ToList());
            }
        }