示例#1
0
 public DragAndDropHelper(FrameworkElement source)
 {
     _source       = source;
     _sourceHelper = new DnDDragDropElementHelper(this, false);
 }
		protected override void OnAttached() {
			base.OnAttached();
			DataControlBase dataCtrl = DataControl;;
			if(dataCtrl != null) {
				DataViewDragDropManager.SetDragDropManager(dataCtrl, this);
				DragDropHelper = new DragDropElementHelper(CreateDragSource(this));
				scrollTimer = new DispatcherTimer();
				scrollTimer.Interval = TimeSpan.FromMilliseconds(100);
				scrollTimer.Tick += new EventHandler(scrollTimer_Tick);
				AutoExpandTimer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(AutoExpandDelay) };
				AutoExpandTimer.Tick += new EventHandler(AutoExpandTimer_Tick);
				DragManager.SetDropTargetFactory(dataCtrl, new DragDropManagerDropTargetFactory());
			}
		}
		protected override void OnAttached() {
			base.OnAttached();
			if(ListBox != null) {
				DragDropManagerBase.SetDragDropManager(ListBox, this);
				DragDropHelper = new DragDropElementHelper(new ListBoxDragSource(this, ListBox));
				DragManager.SetDropTargetFactory(ListBox, new DragDropManagerDropTargetFactory());
			}
		}