private void ListBoxEdit_StartRecordDrag(object sender, StartRecordDragEventArgs e) { // Create the command instance according to the type in the dragged source. List <IUserScript> newData = new List <IUserScript>(); foreach (dynamic item in e.Records) { newData.Add((IUserScript)Activator.CreateInstance((Type)item.ObjectType)); } e.Data.SetData(new RecordDragDropData(newData.ToArray())); }
private void OnStartRecordDrag(object sender, StartRecordDragEventArgs e) { var item = e.Records[0] as MenuStructureProxy; if (item.IsRoot) { e.AllowDrag = false; } else { e.AllowDrag = true; } e.Handled = true; }
private void AssociatedObject_StartRecordDrag(object sender, StartRecordDragEventArgs e) { try { IEnumerable <FileModel> files = e.Records.OfType <FileModel>(); if (files == null || files.Count() == 0) { return; } e.Data = Utilities.CreateDataObject(files.Select(x => x.FullPath).ToArray()); e.AllowDrag = files.All(x => !x.IsRoot && !x.IsDrive); } finally { e.Handled = true; } }