private void Start() { if (_panelAdorner != null || _draggingContainer == null) { return; } if (_adornerLayer == null) { _adornerLayer = AdornerLayer.GetAdornerLayer(_treeView); } if (_panelAdorner == null) { _panelAdorner = GetPanelAdorner(_treeView, _draggingContainer); _adornerLayer.Add(_panelAdorner); _draggingContainer.Opacity = 0.2; } DragDrop.AddQueryContinueDragHandler(_treeView, OnQueryContinueDrag); DragDrop.DoDragDrop(_treeView, _draggingContainer.DataContext, DragDropEffects.Move); DragDrop.RemoveQueryContinueDragHandler(_treeView, OnQueryContinueDrag); End(); }
public MainWindow() { VM_Main viewmodel = new VM_Main(); DataContext = viewmodel; InitializeComponent(); DragDrop.AddQueryContinueDragHandler(this, new QueryContinueDragEventHandler((o, a) => { viewmodel.Dragging = a.Action == DragAction.Continue && a.KeyStates.HasFlag(DragDropKeyStates.LeftMouseButton) && !a.EscapePressed; })); viewmodel.ShowWaitCursor = DisplayWaitCursor; viewmodel.UpdateTextBox = UpdateTextBox; }
private void StartDrag() { if (_panelAdorner != null || _dragedChild == null) { return; } RootAdornerLayer.Add(GetPanelAdorner(AssociatedObject, _dragedChild)); _dragedChild.Opacity = 0; DragDrop.AddQueryContinueDragHandler(AssociatedObject, OnQueryContinueDrag); DragDrop.DoDragDrop(AssociatedObject, _dragedChild, DragDropEffects.Move); DragDrop.RemoveQueryContinueDragHandler(AssociatedObject, OnQueryContinueDrag); EndDrag(); }
private void StartDrag() { if (_elementAdorner != null) { return; } RootAdornerLayer.Add(ElementAdorner); AssociatedObject.Opacity = _hiddenWhileDragging ? 0 : 1; DragDrop.AddQueryContinueDragHandler(AssociatedObject, OnQueryContinueDrag); DragDrop.DoDragDrop(AssociatedObject, AssociatedObject, DragDropEffects.Move); DragDrop.RemoveQueryContinueDragHandler(AssociatedObject, OnQueryContinueDrag); EndDrag(); }
//Start Darg private void StartDrag() { if (_panelAdorner != null || _draggingContainer == null) { return; } if (_panelAdorner == null) { _draggingContainer.Tag = 1; _panelAdorner = GetPanelAdorner(treeView, _draggingContainer); _draggingContainer.Tag = 0; _adornerLayer.Add(_panelAdorner); _draggingContainer.Opacity = 0.2; } DragDrop.AddQueryContinueDragHandler(treeView, OnQueryContinueDrag); DragDrop.DoDragDrop(treeView, _draggingContainer, DragDropEffects.Move); DragDrop.RemoveQueryContinueDragHandler(treeView, OnQueryContinueDrag); EndDrag(); }