private void treeViewDragDrop(DragEventArgs e) { var p = clientPointFrom(e); var targetNode = _treeView.CalcHitInfo(p).Node; var draggedNodes = getDraggedNodesFrom(e); draggedNodes.Each(node => _presenter.MoveNode(node, nodeFrom(targetNode))); e.Effect = DragDropEffects.None; }
private void onMouseDown(object sender, MouseEventArgs e) { this.DoWithinExceptionHandler(() => { var hitInfo = _treeView.CalcHitInfo(e.Location); if (hitInfo == null) { return; } if (hitInfo.Node == null) { return; } var treeNode = _treeView.NodeFrom(hitInfo.Node); if (treeNode.IsAnImplementationOf <HierarchicalStructureNode>() && e.Button.Equals(MouseButtons.Left)) { HierarchicalStructureNode node = (HierarchicalStructureNode)treeNode; var dragItem = _presenter.GetReferenceObjectFrom(node.Tag); if (dragItem != null) { DoDragDrop(dragItem, DragDropEffects.Copy); } } }); }
private void onMouseClick(object sender, MouseEventArgs e) { this.DoWithinExceptionHandler(() => { if (e.Button.Equals(MouseButtons.Right)) { var hitInfo = _treeView.CalcHitInfo(e.Location); if (hitInfo.Node == null) { _presenter.CreatePopupMenuFor(null).At(e.Location); } } }); }
private void onClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } //Show popup only if click was performed on empty space var hitInfo = _treeView.CalcHitInfo(e.Location); if (hitInfo.Node != null) { return; } _presenter.CreatePopupMenuFor(null).At(e.Location); }