aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Core/ExtensionMethods
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-19 17:17:25 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-19 17:17:25 +0200
commit8feeef663f8984c609cb3aa530d09ffcffda5709 (patch)
tree6b69a7a62ea1234ba5b16948dd3781078834a973 /Software/Visual_Studio/Tango.Core/ExtensionMethods
parent95b4e14bc4e06ffb94199f5ec4e0d2d9bebceeff (diff)
downloadTango-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.cs13
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);
+ }
}