private void OnDragInitialize(object sender, DragInitializeEventArgs e) { var sourceRow = e.OriginalSource as GridViewRow ?? (e.OriginalSource as FrameworkElement).ParentOfType <GridViewRow>(); if (sourceRow != null && sourceRow.Name != "PART_RowResizer") { DropIndicationDetails details = new DropIndicationDetails(); var item = sourceRow.Item; details.CurrentDraggedItem = item; IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null); dragPayload.SetData("DraggedItem", item); dragPayload.SetData("DropDetails", details); e.Data = dragPayload; e.DragVisual = new DragVisual() { Content = details, ContentTemplate = this.AssociatedObject.Resources["DraggedItemTemplate"] as DataTemplate }; e.DragVisualOffset = e.RelativeStartPoint; e.AllowedEffects = DragDropEffects.All; } }
private void OnDragInitialize(object sender, DragInitializeEventArgs e) { var sourceRow = e.OriginalSource as GridViewRow ?? (e.OriginalSource as FrameworkElement).ParentOfType<GridViewRow>(); if (sourceRow != null && sourceRow.Name != "PART_RowResizer") { DropIndicationDetails details = new DropIndicationDetails(); var item = sourceRow.Item; details.CurrentDraggedItem = item; IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null); dragPayload.SetData("DraggedItem", item); dragPayload.SetData("DropDetails", details); e.Data = dragPayload; e.DragVisual = new DragVisual() { Content = details, ContentTemplate = this.AssociatedObject.Resources["DraggedItemTemplate"] as DataTemplate }; e.DragVisualOffset = e.RelativeStartPoint; e.AllowedEffects = DragDropEffects.All; } }