private void UIElement_OnMouseMove(object sender, MouseEventArgs e) { if (sender is UIElement el && el.IsMouseCaptured) { _endPoint = e.GetPosition(WorkCanvas); SetPath(); var hit = HitTestHelper.HitTest(WorkCanvas, _endPoint)?.VisualHit; // Debug.Print(hit?.GetType()?.Name ?? "-"); var dest = hit?.FindVisualParent <PinView>(); // Debug.Print(dest==null?"-":"x"); if (dest == null || IsConnectable(dest)) { _dest = dest; } else { _dest = null; } } }
private bool IsConnectable(PinView dest) { return(StartViewModel.IsConnectable(dest.ViewModel)); }