-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDropTarget.cs
More file actions
785 lines (646 loc) · 30.4 KB
/
Copy pathDropTarget.cs
File metadata and controls
785 lines (646 loc) · 30.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
using System;
using System.Net;
using System.Windows;
using System.Windows.Input;
using System.Collections.Generic;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml;
using Windows.Foundation;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;
namespace ControlLibrary
{
/// <summary>
/// Enumeration containing the possible drop behaviours on element removal
/// </summary>
public enum RemoveElementDropBehaviour
{
/// <summary>
/// Enumeration option stating the current child should be replaced on drop
/// </summary>
Replace,
/// <summary>
/// Enumeration option stating a drop should be disallowed when the current child
/// can't be moved to the position of the parent of the dragsource that's being dropped
/// </summary>
Disallow
}
/// <summary>
/// Class defining a droptarget
/// </summary>
public class DropTarget : Control, IDisposable
{
#region Ghost (DependencyProperty)
/// <summary>
/// Ghost control, shown when nothing has been dropped
/// </summary>
public FrameworkElement Ghost
{
get { return (FrameworkElement)GetValue(GhostProperty); }
set { SetValue(GhostProperty, value); }
}
/// <summary>
/// Ghost control, shown when nothing has been dropped
/// </summary>
public static readonly DependencyProperty GhostProperty =
DependencyProperty.Register("Ghost", typeof(FrameworkElement), typeof(DropTarget),
new PropertyMetadata(null));
#endregion
#region GhostVisibility (DependencyProperty)
/// <summary>
/// Determines wether or not the ghost control should be shown
/// </summary>
public Visibility GhostVisibility
{
get { return (Visibility)GetValue(ShowGhostProperty); }
set { SetValue(ShowGhostProperty, value); }
}
/// <summary>
/// Determines wether or not the ghost control should be shown
/// </summary>
public static readonly DependencyProperty ShowGhostProperty =
DependencyProperty.Register("GhostVisibility", typeof(Visibility), typeof(DropTarget),
new PropertyMetadata(Visibility.Visible));
#endregion
#region ShowHover (DependencyProperty)
/// <summary>
/// Determines wether or not a hover effect should be visible
/// when hovering a dragsource over this droptarget
/// </summary>
public bool ShowHover
{
get { return (bool)GetValue(ShowHoverProperty); }
set { SetValue(ShowHoverProperty, value); }
}
/// <summary>
/// Determines wether or not a hover effect should be visible
/// when hovering a dragsource over this droptarget
/// </summary>
public static readonly DependencyProperty ShowHoverProperty =
DependencyProperty.Register("ShowHover", typeof(bool), typeof(DropTarget),
new PropertyMetadata(true));
#endregion
#region AllowPositionSave (DependencyProperty)
/// <summary>
/// Determines wether or not the position of a droptarget should be saved. Setting this option
/// to true results in a significant increase in performance: in regular mode (when this property is
/// false), droptarget positioning is calculated on the fly while dragging a dragsource. When this
/// is set to true, it's only calculated when the droptarget is loaded. Do keep in mind that setting
/// this to true will result in strange behaviour if the droptarget hasn't got a fixed position on screen
/// (eg: when the droptarget itself can be moved around).
/// However, you can recalculate this position by hand by calling the "RecalculatePosition"-method on
/// the droptarget!.
/// This option is advised when you have lots and lots of droptargets on one screen - in other cases,
/// it shouldn't be necessary.
/// </summary>
public bool AllowPositionSave
{
get { return (bool)GetValue(AllowPositionSaveProperty); }
set { SetValue(AllowPositionSaveProperty, value); }
}
/// <summary>
/// Determines wether or not the position of a droptarget should be saved. Setting this option
/// to true results in a significant increase in performance: in regular mode (when this property is
/// false), droptarget positioning is calculated on the fly while dragging a dragsource. When this
/// is set to true, it's only calculated when the droptarget is loaded. Do keep in mind that setting
/// this to true will result in strange behaviour if the droptarget hasn't got a fixed position on screen
/// (eg: when the droptarget itself can be moved around).
/// However, you can recalculate this position by hand by calling the "RecalculatePosition"-method on
/// the droptarget!.
/// This option is advised when you have lots and lots of droptargets on one screen - in other cases,
/// it shouldn't be necessary.
/// </summary>
public static readonly DependencyProperty AllowPositionSaveProperty =
DependencyProperty.Register("AllowPositionSave", typeof(bool), typeof(DropTarget),
new PropertyMetadata(false));
#endregion
#region RemoveElementDropBehaviour (DependencyProperty)
/// <summary>
/// RemoveElementDropBehaviour: if you drop an item on a droptarget which already has a
/// dragsource, and the existing dragsource hasn't got the permission to be
/// dropped where the item you're dropping was residing (or the item you're
/// dropping isn't the child of a droptarget at all), what should happen?
/// Replace the existing dragsource (and thus removing it altogether) or
/// disallow the drop?
/// </summary>
public RemoveElementDropBehaviour RemoveElementDropBehaviour
{
get { return (RemoveElementDropBehaviour)GetValue(RemoveElementDropBehaviourProperty); }
set { SetValue(RemoveElementDropBehaviourProperty, value); }
}
/// <summary>
/// RemoveElementDropBehaviour: if you drop an item on a droptarget which already has a
/// dragsource, and the existing dragsource hasn't got the permission to be
/// dropped where the item you're dropping was residing (or the item you're
/// dropping isn't the child of a droptarget at all), what should happen?
/// Replace the existing dragsource (and thus removing it altogether) or
/// disallow the drop?
/// </summary>
public static readonly DependencyProperty RemoveElementDropBehaviourProperty =
DependencyProperty.Register("RemoveElementDropBehaviour", typeof(RemoveElementDropBehaviour), typeof(DropTarget),
new PropertyMetadata(RemoveElementDropBehaviour.Disallow));
#endregion
#region DropBorderBrush (DependencyProperty)
/// <summary>
/// The brush for the drop border
/// </summary>
public Brush DropBorderBrush
{
get { return (Brush)GetValue(DropBorderBrushProperty); }
set { SetValue(DropBorderBrushProperty, value); }
}
/// <summary>
/// The brush for the drop border
/// </summary>
public static readonly DependencyProperty DropBorderBrushProperty =
DependencyProperty.Register("DropBorderBrush", typeof(Brush), typeof(DropTarget),
new PropertyMetadata(new SolidColorBrush()));
#endregion
#region DropBorderThickness (DependencyProperty)
/// <summary>
/// The thickness of the drop border
/// </summary>
public Thickness DropBorderThickness
{
get { return (Thickness)GetValue(DropBorderThicknessProperty); }
set { SetValue(DropBorderThicknessProperty, value); }
}
/// <summary>
/// The thickness of the drop border
/// </summary>
public static readonly DependencyProperty DropBorderThicknessProperty =
DependencyProperty.Register("DropBorderThickness", typeof(Thickness), typeof(DropTarget),
new PropertyMetadata(new Thickness()));
#endregion
#region DropBorderCornerRadius (DependencyProperty)
/// <summary>
/// The cornerradius of the drop border
/// </summary>
public CornerRadius DropBorderCornerRadius
{
get { return (CornerRadius)GetValue(DropBorderCornerRadiusProperty); }
set { SetValue(DropBorderCornerRadiusProperty, value); }
}
/// <summary>
/// The cornerradius of the drop border
/// </summary>
public static readonly DependencyProperty DropBorderCornerRadiusProperty =
DependencyProperty.Register("DropBorderCornerRadius", typeof(CornerRadius), typeof(DropTarget),
new PropertyMetadata(new CornerRadius()));
#endregion
private Grid plstContent = new Grid();
/// <summary>
/// Contains the content control for a dragtarget
/// </summary>
public DragSource Content
{
get
{
if (MainContentControl != null)
{
if (MainContentControl.Children.Count > 0)
{
return (DragSource)MainContentControl.Children[0];
}
else
{
return null;
}
}
else
{
return null;
}
}
set
{
if (value == null)
{
if (MainContentControl != null)
{
MainContentControl.Children.Clear();
}
}
else
{
if (MainContentControl != null)
{
MainContentControl.Children.Clear();
MainContentControl.Children.Add(value);
}
else
{
// temporary save
plstContent.Children.Add(value);
}
if (value.DropTargets == null)
{
value.DropTargets = new List<DropTarget>();
value.DropTargets.Add(this);
}
}
}
}
private Grid MainControlHost;
private Grid GhostContentControl;
private Grid MainContentControl;
private Border BoundingBorder;
internal bool PositionCalculated = false;
/// <summary>
/// Is a drag source hovering this droptarget?
/// </summary>
private bool DragSourceIsHovering { get; set; }
/// <summary>
/// The drop target entered event
/// </summary>
public event DropEventHandler DropTargetEntered;
/// <summary>
/// The drop target left event
/// </summary>
public event DropEventHandler DropTargetLeft;
/// <summary>
/// The drag source dropped event
/// </summary>
public event DropEventHandler DragSourceDropped;
internal event DropEventHandler InternalDragSourceDropped;
internal Point internalOffset;
/// <summary>
/// Constructor
/// </summary>
public DropTarget()
{
this.DefaultStyleKey = typeof(DropTarget);
// default values
DragSourceIsHovering = false;
PositionCalculated = false;
}
/// <summary>
/// Method used to manually recalculate the droptarget's position. Only to be
/// when AllowPositionSave = true
/// </summary>
/// <returns></returns>
public bool RecalculatePosition()
{
try
{
internalOffset = this.TransformToVisual(Window.Current.Content as UIElement).TransformPoint(new Point(0, 0));
return true;
}
catch (Exception)
{
return false;
}
}
/// <summary>
/// Method overrides OnApplyTemplate to add handlers / get references to control in the template
/// </summary>
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
// all our controls are inside of a canvas control. Because of this, it doesn't
// automatically resize. We need to make sure the parent control is resized properly
// get the main control host
MainControlHost = (Grid)this.GetTemplateChild("MainControlHost");
// get the ghost control host
GhostContentControl = (Grid)this.GetTemplateChild("GhostContentControl");
// get the main content host
MainContentControl = (Grid)this.GetTemplateChild("MainContentControl");
// add the content
if (plstContent.Children.Count > 0)
{
DragSource tmp = (DragSource)plstContent.Children[0];
plstContent.Children.Remove(tmp);
Content = tmp;
//ResetContent();
}
// add the ghost?
if (GhostVisibility == Visibility.Visible)
{
if (Ghost != null)
{
GhostContentControl.Children.Clear();
GhostContentControl.Children.Add(Ghost);
}
}
// get bounding border for hover-effects
BoundingBorder = (Border)this.GetTemplateChild("BoundingBorder");
// add handler for droptargetentered
DropTargetEntered += new DropEventHandler(DropTargetBase_DropTargetEntered);
// add handler for droptargetleft
DropTargetLeft += new DropEventHandler(DropTargetBase_DropTargetLeft);
// add handler for dragsourcedropped
//DragSourceDropped += new DropEventHandler(DropTargetBase_DragSourceDropped);
InternalDragSourceDropped += new DropEventHandler(DropTargetBase_InternalDragSourceDropped);
if (AllowPositionSave)
{
(Window.Current.Content as FrameworkElement).SizeChanged += new SizeChangedEventHandler(DropTarget_SizeChanged);
}
}
void DropTarget_SizeChanged(object sender, SizeChangedEventArgs e)
{
PositionCalculated = false;
}
/// <summary>
/// Resets the content of the droptarget to the "Content"-dragsource
/// </summary>
private void ResetContent()
{
if (plstContent != null)
{
if (MainContentControl != null)
{
MainContentControl.Children.Clear();
if (plstContent.Children.Count > 0)
MainContentControl.Children.Add(plstContent.Children[0]);
}
if (plstContent.Children.Count > 0)
{
if (((DragSource)plstContent.Children[0]).DropTargets == null)
{
((DragSource)plstContent.Children[0]).DropTargets = new System.Collections.Generic.List<DropTarget>();
((DragSource)plstContent.Children[0]).DropTargets.Add(this);
}
}
}
}
/// <summary>
/// Handles the dropping of a dragsource in this droptarget
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void DropTargetBase_InternalDragSourceDropped(object sender, DropEventArgs args)
{
if (ShowHover)
{
// after this, start the hover-out animation on the droptarget
Animation.CreateDropTargetHoverOut(BoundingBorder).Begin();
}
// what if there are children?
if (MainContentControl.Children.Count > 0)
{
// get the current child (which is a dragsource by definition)
// and either switch it with the new child (if the parent of the new child
// is a valid droptarget for the current child - so it must have rights to
// be used as a droptarget to be able to make the switch!) or replace it
DragSource currentChild = (DragSource)MainContentControl.Children[0];
// if currentchild <> child you're dragging (else, we're just dropping our
// dragsource onto its own parent (droptarget)
if (currentChild != args.DragSource)
{
// is the new childs' parent (parent of parent of parent) a droptarget?
Panel firstParent = (Panel)VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(args.DragSource));
if (firstParent != null)
{
// droptarget?
if (VisualTreeHelper.GetParent(firstParent) is DropTarget)
{
DropTarget newChildParentDropTarget = (DropTarget)VisualTreeHelper.GetParent(firstParent);
if (currentChild.DropTargets.Contains(newChildParentDropTarget)
|| currentChild.AllDropTargetsValid == true) // check for valid droptarget, or check if all droptargets are valid
{
// point needed for animation of the current child
Point from = new Point();
from = args.DragSource.getCurrentPosition();
Point offsetCurrentChild = new Point();
if (currentChild.ShowSwitchReplaceAnimation)
{
offsetCurrentChild = currentChild.MainDraggableControl.TransformToVisual(InitialValues.ContainingLayoutPanel).TransformPoint(new Point(0, 0));
}
Point oriOffset = new Point(args.DragSource.OriginalOffset.X, args.DragSource.OriginalOffset.Y);
// reset position of dragsource, so control is on top of ghost, right
// before actually moving it.
args.DragSource.ResetMyPosition();
// remove from current parent
((Panel)VisualTreeHelper.GetParent(args.DragSource)).Children.Remove(args.DragSource);
MainContentControl.Children.Clear();
MainContentControl.Children.Add(args.DragSource);
// move the current child, with or without an animation
if (currentChild.ShowSwitchReplaceAnimation)
{
// animation, from the current position to the new position
// current position = where the new child is now
// new position = where the new child was
// add the current child to its new position, then move it from the
// "current position" to 0, 0 (the new position)
newChildParentDropTarget.MainContentControl.Children.Add(currentChild);
//currentChild.AnimateOnSwitch(from);
Storyboard sb = currentChild.ReturnAnimateOnSwitch(offsetCurrentChild, oriOffset);
EventHandler<object> handler = null;
handler = (send, arg) =>
{
sb.Completed -= handler;
currentChild.ResetMyPosition();
// trigger external dragsourcedropped-event
TriggerDragSourceDropped(args.DragSource);
};
sb.Completed += handler;
sb.Begin();
}
else
{
// no animation
newChildParentDropTarget.MainContentControl.Children.Add(currentChild);
// trigger external dragsourcedropped-event
TriggerDragSourceDropped(args.DragSource);
}
}
else
{
// parent of the new child isn't a VALID droptarget. Depending on DropBehaviour, remove
// current child & set new one (replace-behaviour) or return the new child to
// its original position (disallow-behaviour)
if (RemoveElementDropBehaviour == RemoveElementDropBehaviour.Replace)
{
// reset position of dragsource, so control is on top of ghost, right
// before actually moving it.
args.DragSource.ResetMyPosition();
// remove from current parent
((Panel)VisualTreeHelper.GetParent(args.DragSource)).Children.Remove(args.DragSource);
MainContentControl.Children.Clear();
MainContentControl.Children.Add(args.DragSource);
// trigger external dragsourcedropped-event
TriggerDragSourceDropped(args.DragSource);
}
else
{
// drop is disallowed, return dragsource to original position
args.DragSource.ReturnToOriginalPosition();
// trigger external dragsourcedropped-event
TriggerDragSourceDropped(args.DragSource);
}
}
}
else
{
// parent of the new child isn't a droptarget. Depending on DropBehaviour, remove
// current child & set new one (replace-behaviour) or return the new child to
// its original position (disallow-behaviour)
if (RemoveElementDropBehaviour == RemoveElementDropBehaviour.Replace)
{
// reset position of dragsource, so control is on top of ghost, right
// before actually moving it.
args.DragSource.ResetMyPosition();
// remove from current parent
((Panel)VisualTreeHelper.GetParent(args.DragSource)).Children.Remove(args.DragSource);
MainContentControl.Children.Clear();
MainContentControl.Children.Add(args.DragSource);
// trigger external dragsourcedropped-event
TriggerDragSourceDropped(args.DragSource);
}
else
{
// drop is disallowed, return dragsource to original position
args.DragSource.ReturnToOriginalPosition();
// trigger external dragsourcedropped-event
TriggerDragSourceDropped(args.DragSource);
}
}
}
else
{
// reset position of dragsource, so control is on top of ghost, right
// before actually moving it.
args.DragSource.ResetMyPosition();
// remove from current parent
((Panel)VisualTreeHelper.GetParent(args.DragSource)).Children.Remove(args.DragSource);
MainContentControl.Children.Clear();
MainContentControl.Children.Add(args.DragSource);
// trigger external dragsourcedropped-event
TriggerDragSourceDropped(args.DragSource);
}
}
else
{
// reset position of dragsource, so control is on top of ghost, right
// before actually moving it.
args.DragSource.ResetMyPosition();
// trigger external dragsourcedropped-event
TriggerDragSourceDropped(args.DragSource);
}
}
else
{
// reset position of dragsource, so control is on top of ghost, right
// before actually moving it.
args.DragSource.ResetMyPosition();
// remove from current parent
((Panel)VisualTreeHelper.GetParent(args.DragSource)).Children.Remove(args.DragSource);
MainContentControl.Children.Clear();
MainContentControl.Children.Add(args.DragSource);
((DropTarget)VisualTreeHelper.GetParent((Panel)VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(args.DragSource)))).Content = null;
this.Content = args.DragSource;
// trigger external dragsourcedropped-event
TriggerDragSourceDropped(args.DragSource);
}
}
void DropTargetBase_DropTargetLeft(object sender, DropEventArgs args)
{
if (DragSourceIsHovering)
{
// set value of boolean
DragSourceIsHovering = false;
if (ShowHover)
{
// hide control
Animation.CreateDropTargetHoverOut(BoundingBorder).Begin();
}
}
}
void DropTargetBase_DropTargetEntered(object sender, DropEventArgs args)
{
if (!DragSourceIsHovering)
{
// set value of boolean
DragSourceIsHovering = true;
if (ShowHover)
{
// show control
Animation.CreateDropTargetHoverIn(BoundingBorder).Begin();
}
}
}
internal void TriggerDropTargetEntered(DragSource source)
{
// Fire the drop target entered event
if (DropTargetEntered != null)
{
this.DropTargetEntered(this, new DropEventArgs(source));
}
}
internal void RemoveBorder()
{
// procedure is only used when double-checking the removal of all borders, just in case.
if (DragSourceIsHovering)
{
DragSourceIsHovering = false;
Animation.CreateDropTargetHoverOutFromAnyAnimationPosition(BoundingBorder).Begin();
}
}
internal void TriggerDragSourceDropped(DragSource source)
{
// double-check: remove all borders
source.RemoveAllDropBorders();
// Fire the drop target dropped event
if (DragSourceDropped != null)
{
this.DragSourceDropped(this, new DropEventArgs(source));
}
}
internal void TriggerDropTargetLeft(DragSource source)
{
// Fire the drop target left event
if (DropTargetLeft != null)
{
this.DropTargetLeft(this, new DropEventArgs(source));
}
}
internal void TriggerInternalDragSourceDropped(DragSource source)
{
// Fire the drop target entered event
if (InternalDragSourceDropped != null)
{
this.InternalDragSourceDropped(this, new DropEventArgs(source));
}
}
#region IDisposable Members
// reference IDisposable Pattern: http://msdn.microsoft.com/en-us/magazine/cc163392.aspx
/// <summary>
/// Destructor.
/// </summary>
~DropTarget()
{
Dispose(false);
}
/// <summary>
/// DPerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
MainControlHost = null;
GhostContentControl = null;
MainContentControl = null;
BoundingBorder = null;
// remove handlers
DropTargetEntered -= new DropEventHandler(DropTargetBase_DropTargetEntered);
DropTargetLeft -= new DropEventHandler(DropTargetBase_DropTargetLeft);
InternalDragSourceDropped -= new DropEventHandler(DropTargetBase_InternalDragSourceDropped);
//if (AllowPositionSave)
//{
(Window.Current.Content as FrameworkElement).SizeChanged -= new SizeChangedEventHandler(DropTarget_SizeChanged);
//}
}
// Clean up all native resources
}
#endregion
}
}