aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.DragAndDrop
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-05-01 16:57:53 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-05-01 16:57:53 +0300
commit7b0167e82bb1f5878b0461e0022db0d382bf7ec7 (patch)
treecbf32f1266d45dfa8d6dd0581979d53232430993 /Software/Visual_Studio/Tango.DragAndDrop
parentaeac0422cb4e989426f3367113627f6c86bcecfb (diff)
downloadTango-7b0167e82bb1f5878b0461e0022db0d382bf7ec7.tar.gz
Tango-7b0167e82bb1f5878b0461e0022db0d382bf7ec7.zip
Fixed issue with drag and drop.
Diffstat (limited to 'Software/Visual_Studio/Tango.DragAndDrop')
-rw-r--r--Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs24
1 files changed, 20 insertions, 4 deletions
diff --git a/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs b/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs
index 8bd5e7e0b..320891c61 100644
--- a/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs
+++ b/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs
@@ -500,7 +500,7 @@ namespace Tango.DragAndDrop
bool found = false;
- foreach (var dropElement in _dropElements.Where(x => x != _currentDragedElement))
+ foreach (var dropElement in _dropElements.Where(x => x != null && x != _currentDragedElement))
{
if (!dropElement.IsLoaded)
{
@@ -532,7 +532,7 @@ namespace Tango.DragAndDrop
{
SetIsDraggableOver(dropElement, true);
- foreach (var drop in _dropElements.Where(x => x != dropElement))
+ foreach (var drop in _dropElements.Where(x => x != null && x != dropElement))
{
SetIsDraggableOver(drop, false);
}
@@ -568,6 +568,14 @@ namespace Tango.DragAndDrop
/// <param name="element">The element.</param>
private static void RegisterDraggable(FrameworkElement element)
{
+ foreach (var item in _dragElements.ToList())
+ {
+ if (item == null)
+ {
+ _dragElements.Remove(item);
+ }
+ }
+
if (!_dragElements.Contains(element))
{
_dragElements.Add(element);
@@ -591,6 +599,14 @@ namespace Tango.DragAndDrop
/// <param name="element">The element.</param>
private static void RegisterDroppable(FrameworkElement element)
{
+ foreach (var item in _dropElements.ToList())
+ {
+ if (item == null)
+ {
+ _dropElements.Remove(item);
+ }
+ }
+
if (!_dropElements.Contains(element))
{
_dropElements.Add(element);
@@ -715,7 +731,7 @@ namespace Tango.DragAndDrop
_dragTimer.Stop();
SetIsDragging(_currentDragedElement, false);
- foreach (var dropElement in _dropElements)
+ foreach (var dropElement in _dropElements.Where(x => x != null))
{
SetIsDraggableOver(dropElement, false);
}
@@ -763,7 +779,7 @@ namespace Tango.DragAndDrop
FrameworkElement element = sender as FrameworkElement;
- if (!_dragElements.ToList().Exists(x => x == element))
+ if (!_dragElements.Where(x => x != null).ToList().Exists(x => x == element))
{
e.Handled = false;
return;