private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e) { object sourceItem = DragDropPayloadManager.GetDataFromObject(e.Data, __dragSource); TreeListViewRow destinationRow = (e.OriginalSource as TreeListViewRow) ?? (e.OriginalSource as FrameworkElement).ParentOfType <TreeListViewRow>(); GridViewScrollViewer destinationTree = (e.OriginalSource as GridViewScrollViewer) ?? (e.OriginalSource as FrameworkElement).ParentOfType <GridViewScrollViewer>(); if (destinationRow != null && destinationRow.Item != sourceItem) { e.Effects = !IsChildOf(destinationRow, sourceItem) ? DragDropEffects.Move : DragDropEffects.None; if (e.Effects == DragDropEffects.Move) { DragDropPayloadManager.SetData(e.Data, __dragTarget, destinationRow.Item); } } else if (destinationTree != null) { DragDropPayloadManager.SetData(e.Data, __dragTarget, string.Empty); } else { e.Effects = DragDropEffects.None; } e.Handled = true; }
void AssociatedObject_DataLoaded(object sender, EventArgs e) { this.AssociatedObject.DataLoaded -= new EventHandler <EventArgs>(AssociatedObject_DataLoaded); this.AttachDropPositionFeedback(); this.scrollViewer = this.AssociatedObject.ChildrenOfType <GridViewScrollViewer>().FirstOrDefault(); this.scrollViewer.ScrollChanged += new ScrollChangedEventHandler(scrollViewer_ScrollChanged); this.scrollViewerScrollTimer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.02) }; this.scrollViewerScrollTimer.Tick += new EventHandler(this.OnScrollViewerScrollTimerCompleted); }