Пример #1
0
        public void TransferItem(GridAdapter srcGridAdapter, MyItem item)
        {
            Tuple <GridAdapter, MyItem> tuple = new Tuple <GridAdapter, MyItem>(srcGridAdapter, item);
//            _items.Add(tuple);
            Vector offset = VisualTreeHelper.GetOffset(srcGridAdapter);

//            Canvas.SetLeft(Temp, offset.X);
//            Canvas.SetTop(Temp, offset.Y);
            srcGridAdapter.Remove(item);
            ((GridAdapter)MainGrid.Children[CurrentMouseOverIndex]).Add(item);
        }
Пример #2
0
//        protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) {
//            if (!_isMouseDown) {
////                Console.WriteLine("Mouse was NOT down on {0}", Content);
//                return;
//            }
////            Console.WriteLine("Mouse was down on {0}", Content);
//            _isMouseDown = false;
//            if (!_isDragged) {
////                Grow();
////                Console.WriteLine("Mouse was NOT dragged on {0}", Content);
//                BorderBrush = Brushes.Black;
//            } else {
////                Console.WriteLine("Mouse was dragged on {0}", Content);
//                ((GridAdapter) Parent).MaybeRemove(this);
////                ((MainWindow) Application.Current.MainWindow).RetrieveFromTemp();
//
//                Panel.SetZIndex(this, 0);
//                Panel.SetZIndex((UIElement) Parent, 0);
//            }
//
//            base.OnMouseLeftButtonUp(e);
//        }
//
//        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs mouseButtonEventArgs) {
//            if (mouseButtonEventArgs.Handled) {
//                return;
//            }
//
//            base.OnMouseLeftButtonDown(mouseButtonEventArgs);
//            mouseButtonEventArgs.Handled = true;
////            Console.WriteLine("Mouse is down");
////            Shrink();
//            // don't mark as dragged until movement occurs
//            _isMouseDown = true;
//            _isDragged = false;
//        }
//
//        private void OnDragDelta(object sender, DragDeltaEventArgs e) {
//            _isDragged = true; // only mark as dragged when actual movement occurs
////            Console.WriteLine("Mouse is dragging");
//            Panel.SetZIndex(this, 999);
//            Panel.SetZIndex((UIElement) Parent, 999);
//            Canvas.SetLeft(this, Canvas.GetLeft(this) + e.HorizontalChange);
//            Canvas.SetTop(this, Canvas.GetTop(this) + e.VerticalChange);
//            Canvas.SetRight(this, Canvas.GetRight(this) + e.HorizontalChange);
//            Canvas.SetBottom(this, Canvas.GetBottom(this) + e.VerticalChange);
//        }
//
//        public void SetContainerRect(GridAdapter adapter, int left, int top, int right, int bottom) {
//            SetContainerRect(adapter, left, top, right, bottom, false);
//        }
//
        public void SetContainerRect(GridAdapter adapter, int left, int top, int right, int bottom, bool animate)
        {
            Console.WriteLine("Setting container rect for: {0}, left: {1}, top: {2}, right: {3}, bottom: {4}",
                              Content, left, top, right, bottom);

            this.Width  = right - left;
            this.Height = bottom - top;
//            if (Parent != null && Parent.GetType() == typeof(Canvas)) {
//////                Show();
//                Move(adapter, left, top, TimeSpan.FromMilliseconds(250), 0);
//            } else {
            Canvas.SetLeft(this, left);
            Canvas.SetRight(this, right);
            Canvas.SetTop(this, top);
            Canvas.SetBottom(this, bottom);
//                if (animate) {
//                    Show();
//                    Move(adapter, left, top, TimeSpan.FromMilliseconds(250), 0);
//                }
//            }
        }