Exemplo n.º 1
0
        private void OnListControlDragItemsCompleted(object sender, DragItemsCompletedEventArgs args)
        {
            object CreateNewParent(IReadOnlyList <object> items, TreeViewList listControl, TreeViewNode rootNode)
            {
                if (listControl != null && items != null && items.Count > 0)
                {
                    var draggedNode = listControl.NodeFromItem(items[0]);
                    if (draggedNode != null)
                    {
                        var parentNode = draggedNode.Parent;
                        if (parentNode != null && parentNode != rootNode)
                        {
                            return(ListControl.ItemFromNode(parentNode));
                        }
                    }
                }
                return(null);
            }

            var newParent = CreateNewParent(args.Items, ListControl, m_rootNode);

            var treeViewArgs = new TreeViewDragItemsCompletedEventArgs(args, newParent);

            DragItemsCompleted?.Invoke(this, treeViewArgs);
        }
Exemplo n.º 2
0
        private void TreeView_DragItemsCompleted(MUXC.TreeView sender, MUXC.TreeViewDragItemsCompletedEventArgs args)
        {
            foreach (TreeViewData item in args.Items)
            {
                item.Parent = args.NewParent as TreeViewData;
            }

            DraggedItems.Clear();
        }