diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-19 17:17:25 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-19 17:17:25 +0200 |
| commit | 8feeef663f8984c609cb3aa530d09ffcffda5709 (patch) | |
| tree | 6b69a7a62ea1234ba5b16948dd3781078834a973 /Software/Visual_Studio/Tango.Core/ExtensionMethods | |
| parent | 95b4e14bc4e06ffb94199f5ec4e0d2d9bebceeff (diff) | |
| download | Tango-8feeef663f8984c609cb3aa530d09ffcffda5709.tar.gz Tango-8feeef663f8984c609cb3aa530d09ffcffda5709.zip | |
Working on new developer module...
Diffstat (limited to 'Software/Visual_Studio/Tango.Core/ExtensionMethods')
| -rw-r--r-- | Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs index d7161953f..948be3c4a 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs @@ -41,5 +41,18 @@ public static class ObservableCollectionExtensions collection[index1] = collection[index2]; collection[index2] = tmp; } + + /// <summary> + /// Removes the dragged element and inserts it after the dropped element position. + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="collection">The collection.</param> + /// <param name="dragged">The dragged element.</param> + /// <param name="dropped">The dropped element.</param> + public static void DragAndDrop<T>(this ObservableCollection<T> collection, T dragged, T dropped) + { + collection.Remove(dragged); + collection.Insert(collection.IndexOf(dropped), dragged); + } } |
