예제 #1
0
        private void BeginDrag(FrameworkElement dragContainer)
        {
            m_dragItem = dragContainer;
            if (m_dragItem == null)
            {
                return;
            }

            // get the index of the item (and make sure that it is a valid child)
            m_dragItemIndex = this.ItemContainerGenerator.IndexFromContainer(m_dragItem);
            if (m_dragItemIndex == -1)
            {
                return;
            }

            // create an adorner
            m_dragAdorner = new DragPreviewAdorner(m_dragItem, m_dragItem);
            m_dragAdorner.IsHitTestVisible = false;
            this.m_adornerLayer.Add(m_dragAdorner);

            // tell the item it's dragging and hide it
            SetIsDragging(m_dragItem, true);
            m_dragItem.Visibility = Visibility.Hidden;

            // get the current location of the mouse
            m_mouseDown = Mouse.GetPosition(this);

            // set mouse capture (so that we are dragging)
            Mouse.Capture(this);
            m_isDragging = true;

            // raise an event to signal that we've started ragging
            RaiseReorderBeginEvent();
        }
예제 #2
0
        private void BeginDrag(FrameworkElement dragContainer)
        {
            m_dragItem = dragContainer;
              if (m_dragItem == null) return;

              // get the index of the item (and make sure that it is a valid child)
              m_dragItemIndex = this.ItemContainerGenerator.IndexFromContainer(m_dragItem);
              if (m_dragItemIndex == -1) return;

              // create an adorner
              m_dragAdorner = new DragPreviewAdorner(m_dragItem, m_dragItem);
              m_dragAdorner.IsHitTestVisible = false;
              this.m_adornerLayer.Add(m_dragAdorner);

              // tell the item it's dragging and hide it
              SetIsDragging(m_dragItem, true);
              m_dragItem.Visibility = Visibility.Hidden;

              // get the current location of the mouse
              m_mouseDown = Mouse.GetPosition(this);

              // set mouse capture (so that we are dragging)
              Mouse.Capture(this);
              m_isDragging = true;

              // raise an event to signal that we've started ragging
              RaiseReorderBeginEvent();
        }