diff -r 84b3bf5ee3d2 -r 8b513df1b446 src/FingersDance.Views/TimelineView.xaml.cs --- a/src/FingersDance.Views/TimelineView.xaml.cs Wed Oct 07 17:16:46 2009 +0200 +++ b/src/FingersDance.Views/TimelineView.xaml.cs Fri Oct 09 11:33:35 2009 +0200 @@ -6,13 +6,10 @@ using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; -using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -using Microsoft.Surface.Presentation.Controls; -using Microsoft.Surface.Presentation; using FingersDance.Data; using FingersDance.ViewModels; @@ -25,76 +22,15 @@ /// public partial class TimelineView : UserControl { + + private Boolean hasDragCanceledHandler = false; + public TimelineView() { InitializeComponent(); } - private void listview_PreviewContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) - { - FrameworkElement findSource = e.OriginalSource as FrameworkElement; - SurfaceListBoxItem draggedElement = null; - - // Find the touched SurfaceListBoxItem object. - while (draggedElement == null && findSource != null) - { - if ((draggedElement = findSource as SurfaceListBoxItem) == null) - { - findSource = VisualTreeHelper.GetParent(findSource) as FrameworkElement; - } - } - - if (draggedElement == null) - { - return; - } - - // Create the cursor visual. - ContentControl cursorVisual = new ContentControl() - { - Content = new TimelineAnnotationView() - { - DataContext = findSource.DataContext - } - }; - - // We apply the current scale to the dragged annotation - ((TimelineAnnotationView)cursorVisual.Content).RenderTransform = this.RenderTransform; - - // Add a handler. This will enable the application to change the visual cues. - //SurfaceDragDrop.AddTargetChangedHandler(cursorVisual, OnTargetChanged); - - // Create a list of input devices. Add the contacts that - // are currently captured within the dragged element and - // the current contact (if it isn't already in the list). - List devices = new List(); - devices.Add(e.Contact); - foreach (Contact contact in draggedElement.ContactsCapturedWithin) - { - if (contact != e.Contact) - { - devices.Add(contact); - } - } - - // Get the drag source object - ItemsControl dragSource = ItemsControl.ItemsControlFromItemContainer(draggedElement); - - bool startDragOkay = - SurfaceDragDrop.BeginDragDrop( - dragSource, // The SurfaceListBox object that the cursor is dragged out from. - draggedElement, // The SurfaceListBoxItem object that is dragged from the drag source. - cursorVisual, // The visual element of the cursor. - draggedElement.DataContext, // The data associated with the cursor. - devices, // The input devices that start dragging the cursor. - DragDropEffects.Move); // The allowed drag-and-drop effects of the operation. - - // If the drag began successfully, set e.Handled to true. - // Otherwise SurfaceListBoxItem captures the contact - // and causes the drag operation to fail. - e.Handled = startDragOkay; - - } + } }