Example #1
0
        private void BaseList_DragInsert(object sender, DragInsertEventArgs e)
        {
            TableBaseItem dragFrom = e.DragFrom as TableBaseItem;
            TableBaseItem dragTo   = e.DragTo as TableBaseItem;

            if (dragFrom == null || dragTo == null)
            {
                return;
            }

            int itemIdx = _ConstructFile.ConstructItems.IndexOf(dragFrom);
            int pos     = _ConstructFile.ConstructItems.IndexOf(dragTo);

            if (itemIdx < pos)
            {
                --pos;
            }

            if (!e.IsDropFront)
            {
                ++pos;
            }

            _ConstructFile.ConstructItems.MovePosToPos(itemIdx, pos);
        }
Example #2
0
        private void Border_Drop(object sender, DragEventArgs e)
        {
            if (DragInsertEvent == null)
            {
                return;
            }

            if (!e.Data.GetDataPresent(typeof(DragInfo)))
            {
                return;
            }

            DragInfo data  = e.Data.GetData(typeof(DragInfo)) as DragInfo;
            Border   panel = _DragOverItem;


            if (panel != null && panel != data.DragFrom && TreeID == data.PanelID)
            {
                panel.BorderThickness = new Thickness(0);

                DragInsertEventArgs insertEvent = new DragInsertEventArgs();
                insertEvent.DragFrom = data.DragFrom.DataContext;
                insertEvent.DragTo   = panel.DataContext;

                if (!_IsButtom)
                {
                    insertEvent.IsDropFront = true;
                }
                else
                {
                    insertEvent.IsDropFront = false;
                }

                DragInsertEvent(this, insertEvent);
            }
            else
            {
                if (_DragOverItem != null)
                {
                    _DragOverItem.BorderThickness = new Thickness(0);
                }
            }
        }