private static void OnDragInitialize(object sender, DragInitializeEventArgs e) { RadGridView grid = (RadGridView)sender; var source = e.OriginalSource as FrameworkElement; if (source != null && source.Name != "PART_RowResizer") { DragDropIndicationDetail details = new DragDropIndicationDetail(); var item = (sender as RadGridView).SelectedItem; 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 = grid.Resources["DraggedItemTemplate"] as DataTemplate }; e.DragVisualOffset = e.RelativeStartPoint; e.AllowedEffects = DragDropEffects.All; } }
private void OnDragInitialize(object sender, DragInitializeEventArgs e) { DragDropIndicationDetail details = new DragDropIndicationDetail(); var items = (sender as RadListBox).SelectedItems; details.CurrentDraggedItem = items; IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null); dragPayload.SetData("DraggedData", items); dragPayload.SetData("DropDetails", details); e.Data = dragPayload; //Si les infos du drag&drop ne doivent pas être cachées if (GetInfosHidden(sender as DependencyObject).Equals(false)) { e.DragVisual = new DragVisual() { Content = details, ContentTemplate = this.AssociatedObject.Resources["DraggedItemTemplate"] as DataTemplate }; } else { e.DragVisual = new DragVisual(); } e.DragVisualOffset = new Point(e.RelativeStartPoint.X + 20, e.RelativeStartPoint.Y + 20); e.AllowedEffects = DragDropEffects.All; }