From 8feeef663f8984c609cb3aa530d09ffcffda5709 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 19 Feb 2018 17:17:25 +0200 Subject: Working on new developer module... --- .../ExtensionMethods/ObservableCollectionExtensions.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Software/Visual_Studio/Tango.Core/ExtensionMethods') 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; } + + /// + /// Removes the dragged element and inserts it after the dropped element position. + /// + /// + /// The collection. + /// The dragged element. + /// The dropped element. + public static void DragAndDrop(this ObservableCollection collection, T dragged, T dropped) + { + collection.Remove(dragged); + collection.Insert(collection.IndexOf(dropped), dragged); + } } -- cgit v1.3.1