DragStartingContext IDragDropElement.DragStarting(DragDropTrigger trigger, object initializeContext) { this.Opacity = 0; DragStartingContext context = this.CreateDragContext(); this.Owner.DragBehavior.OnDragStarted(this); this.Owner.CancelEdit(); this.Owner.ContentFlyout.Hide(DataGridFlyoutId.All); this.IsSelected = false; return(context); }
DragStartingContext IDragDropElement.DragStarting(DragDropTrigger trigger, object initializeContext) { this.ListView.CleanupSwipedItem(); DragStartingContext context = null; var dataItem = this.DataContext; if (dataItem != null) { bool isExecuted = false; DragAction?dragAction = null; if (trigger == DragDropTrigger.Drag && initializeContext != this.reorderHandle) { if (this.ListView.LayoutDefinition is StackLayoutDefinition) { if (this.Owner.Orientation == Orientation.Horizontal) { if (this.SwipeDirection == ListViewItemSwipeDirection.Forward) { DragDrop.SetDragPositionMode(this, DragPositionMode.RailYForward); } else if (this.SwipeDirection == ListViewItemSwipeDirection.Backwards) { DragDrop.SetDragPositionMode(this, DragPositionMode.RailYBackwards); } else if (this.SwipeDirection == ListViewItemSwipeDirection.All) { DragDrop.SetDragPositionMode(this, DragPositionMode.RailY); } } else { if (this.SwipeDirection == ListViewItemSwipeDirection.Forward) { DragDrop.SetDragPositionMode(this, DragPositionMode.RailXForward); } else if (this.SwipeDirection == ListViewItemSwipeDirection.Backwards) { DragDrop.SetDragPositionMode(this, DragPositionMode.RailXBackwards); } else if (this.SwipeDirection == ListViewItemSwipeDirection.All) { DragDrop.SetDragPositionMode(this, DragPositionMode.RailX); } } isExecuted = this.ListView.commandService.ExecuteCommand(CommandId.ItemDragStarting, new ItemDragStartingContext(dataItem, DragAction.ItemAction, this)); dragAction = DragAction.ItemAction; this.PrepareDragVisual(dragAction.Value); } } else { isExecuted = this.ListView.commandService.ExecuteCommand(CommandId.ItemDragStarting, new ItemDragStartingContext(dataItem, DragAction.Reorder, this)); dragAction = DragAction.Reorder; this.PrepareDragVisual(dragAction.Value); } if (isExecuted && dragAction.HasValue) { this.CancelDirectManipulations(); if (dragAction.Value == DragAction.Reorder) { context = this.InitializeReorder(); } else if (dragAction.Value == DragAction.ItemAction) { // We might need to cancel manipulations on the dragvisual //// this.dragVisual.CancelDirectManipulations(); this.UpdateActionContentClipping(0); context = new DragStartingContext { DragSurface = new CanvasDragSurface(this.ListView.childrenPanel, this.ListView.childrenPanel as Canvas, false), DragVisual = this.dragVisual, HitTestStrategy = new ListViewItemHittestStrategy(this, this), Payload = DragAction.ItemAction }; } } } return(context); }