Ejemplo n.º 1
0
        /// <summary>
        /// Starts drag object.
        /// </summary>
        /// <param name="sender">Either Main Window or data grid control.</param>
        /// <param name="e">Event args.</param>
        private void _MouseMove(object sender, MouseEventArgs e)
        {
            if (Mouse.LeftButton == MouseButtonState.Pressed && _mustStartDraggingOnMouseMove)
            {
                Row currentRow = OrdersGrid.GetContainerFromItem(OrdersGrid.CurrentItem) as Row;
                if (currentRow == null)
                {
                    return;
                }

                Cell currentCell = currentRow.Cells[OrdersGrid.CurrentContext.CurrentColumn];
                if (currentCell == null || currentCell.IsBeingEdited) // if user try to select text in cell we shouldn't begin drag'n'drop
                {
                    return;
                }

                if (OrdersGrid.SelectedItems.Count > 0)
                {
                    _TryToStartDragging();
                }
            }

            // Reset the flat on any mouse move without pressed left button.
            _mustStartDraggingOnMouseMove = false;
        }