- Timestamp:
- 03/28/11 14:53:01 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r5744 r5837 253 253 if (items.Count > 0) { 254 254 DataObject data = new DataObject(); 255 if (items.Count == 1) data.SetData( "HeuristicLab", items[0]);256 else data.SetData( "HeuristicLab", items);255 if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]); 256 else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items); 257 257 if (Content.IsReadOnly || ReadOnly) { 258 258 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); … … 268 268 protected virtual void itemsListView_DragEnter(object sender, DragEventArgs e) { 269 269 validDragOperation = false; 270 if ( e.Data.GetData("HeuristicLab") is T) {270 if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) { 271 271 validDragOperation = true; 272 } else if ( e.Data.GetData("HeuristicLab") is IEnumerable) {272 } else if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) { 273 273 validDragOperation = true; 274 IEnumerable items = (IEnumerable)e.Data.GetData( "HeuristicLab");274 IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 275 275 foreach (object item in items) 276 276 validDragOperation = validDragOperation && (item is T); 277 277 } 278 validDragOperation = validDragOperation && !Content.IsReadOnly && !ReadOnly;279 278 } 280 279 protected virtual void itemsListView_DragOver(object sender, DragEventArgs e) { … … 290 289 protected virtual void itemsListView_DragDrop(object sender, DragEventArgs e) { 291 290 if (e.Effect != DragDropEffects.None) { 292 if (e.Data.GetData( "HeuristicLab") is T) {293 T item = (T)e.Data.GetData( "HeuristicLab");291 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) { 292 T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 294 293 Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item); 295 } else if (e.Data.GetData( "HeuristicLab") is IEnumerable) {296 IEnumerable<T> items = ((IEnumerable)e.Data.GetData( "HeuristicLab")).Cast<T>();294 } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { 295 IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>(); 297 296 foreach (T item in items) 298 297 Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
Note: See TracChangeset
for help on using the changeset viewer.