Пример #1
0
        public override DragAndDropVisualMode DoDrag(TreeViewItem parentItem, TreeViewItem targetItem, bool perform, TreeViewDragging.DropPosition dropPos)
        {
            TestDragging.FooDragData fooDragData     = DragAndDrop.GetGenericData("FooDragging") as TestDragging.FooDragData;
            FooTreeViewItem          fooTreeViewItem = parentItem as FooTreeViewItem;
            DragAndDropVisualMode    result;

            if (fooTreeViewItem != null && fooDragData != null)
            {
                bool flag = this.ValidDrag(parentItem, fooDragData.m_DraggedItems);
                if (perform && flag)
                {
                    List <BackendData.Foo> draggedItems = (from x in fooDragData.m_DraggedItems
                                                           where x is FooTreeViewItem
                                                           select((FooTreeViewItem)x).foo).ToList <BackendData.Foo>();
                    int[] selectedIDs = (from x in fooDragData.m_DraggedItems
                                         where x is FooTreeViewItem
                                         select((FooTreeViewItem)x).id).ToArray <int>();
                    int insertionIndex = TreeViewDragging.GetInsertionIndex(parentItem, targetItem, dropPos);
                    this.m_BackendData.ReparentSelection(fooTreeViewItem.foo, insertionIndex, draggedItems);
                    this.m_TreeView.ReloadData();
                    this.m_TreeView.SetSelection(selectedIDs, true);
                }
                result = ((!flag) ? DragAndDropVisualMode.None : DragAndDropVisualMode.Move);
            }
            else
            {
                result = DragAndDropVisualMode.None;
            }
            return(result);
        }
 public override void FetchData()
 {
     itemCounter = 1;
     m_RootItem  = new FooTreeViewItem(m_Backend.root.id, 0, null, m_Backend.root.name, m_Backend.root);
     AddChildrenRecursive(m_Backend.root, m_RootItem);
     m_NeedRefreshRows = true;
 }
        public override void FetchData()
        {
            // For LazyTreeViewDataSources we just generate the 'm_VisibleRows' items:
            itemCounter = 1;
            m_RootItem  = new FooTreeViewItem(m_Backend.root.id, 0, null, m_Backend.root.name, m_Backend.root);
            AddVisibleChildrenRecursive(m_Backend.root, m_RootItem);

            m_Rows = new List <TreeViewItem>();
            GetVisibleItemsRecursive(m_RootItem, m_Rows);
            m_NeedRefreshRows = false;
        }
Пример #4
0
        public override DragAndDropVisualMode DoDrag(TreeViewItem parentItem, TreeViewItem targetItem, bool perform, TreeViewDragging.DropPosition dropPos)
        {
            FooDragData     genericData = DragAndDrop.GetGenericData("FooDragging") as FooDragData;
            FooTreeViewItem item        = parentItem as FooTreeViewItem;

            if ((item != null) && (genericData != null))
            {
                bool flag = this.ValidDrag(parentItem, genericData.m_DraggedItems);
                if (perform && flag)
                {
                    if (< > f__am$cache0 == null)
                    {