private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = DataContext as DesignerItem; if (this.designerItem != null) { this.designerCanvas = VisualHelper.FindAnchestor <DrawingLayer>(this.designerItem); } }
private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = DataContext as DesignerItem; if (this.designerItem != null) { this.designerCanvas = VisualHelper.FindAnchestor <DrawingLayer>(this.designerItem) as DrawingLayer; AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.designerCanvas); if (adornerLayer != null) { this.adorner = new SizeAdorner(this.designerItem); adornerLayer.Add(this.adorner); } } }
void _drager_OnContinueDrag(object sender, MouseEventArgs e) { try { // Get the dragged ListViewItem ListViewItem item = VisualHelper.FindAnchestor <ListViewItem>((DependencyObject)e.OriginalSource); if (item != null) { object associatedData = this.ItemContainerGenerator.ItemFromContainer(item); _drager.DragDropContinue(associatedData != null); } } catch (Exception err) { LogHelper.Manage("ExtendedlistView:drag_OnStartDrag", err); } }
void drag_OnStartDrag(object sender, MouseEventArgs e) { try { // Get the dragged ListViewItem ListViewItem item = VisualHelper.FindAnchestor <ListViewItem>((DependencyObject)e.OriginalSource); if (item != null) { object associatedData = this.ItemContainerGenerator.ItemFromContainer(item); // Find the data behind the item + Initialize the drag & drop operation DataObject dragData = new DataObject(DragAndDropID, associatedData); _drager.DoDragDrop(dragData, item); } } catch (Exception err) { LogHelper.Manage("ExtendedlistView:drag_OnStartDrag", err); } }
protected override void OnPreviewMouseDown(MouseButtonEventArgs e) { base.OnPreviewMouseDown(e); DrawingLayer designer = VisualHelper.FindAnchestor <DrawingLayer>(this) as DrawingLayer; if (designer != null) { if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None) { this.IsSelected = !this.IsSelected; } else { if (!this.IsSelected) { designer.DeselectAll(); this.IsSelected = true; } } } e.Handled = false; }