public void EmphasizeCurves(Point point)
            {
                if (lastEmphasizedPrimitiveCurve != null)
                {
                    NewPrimitiveCurvesControl.SetIsEmphasized(lastEmphasizedPrimitiveCurve, false);
                }

                var curve = FindNearbyCurve(point);

                if (curve != null)
                {
                    NewPrimitiveCurvesControl.SetIsEmphasized(curve, true);
                    lastEmphasizedPrimitiveCurve = curve;
                }
            }
            private FrameworkElement FindNearbyCurve(Point point)
            {
                var vec      = new Vector(5, 5);
                var geometry = new RectangleGeometry(new Rect(point - vec, point + vec));
                var htParams = new GeometryHitTestParameters(geometry);

                var curve = (FrameworkElement)primitiveCurvesRoot.HitTestFirst(
                    htParams,
                    dp =>
                {
                    var fwElement = dp as FrameworkElement;
                    return(fwElement != null && NewPrimitiveCurvesControl.GetPrimitiveCurve(fwElement) != null);
                });

                return(curve);
            }
            protected override void MouseUpCore(MousePosInfo3D position, Vector vec2d, Vector3D?vec3d)
            {
                EmphasizeCurves(position.Pos2D);

                if (lastEmphasizedSketchCurve != null)
                {
                    lastEmphasizedSketchCurve.IsEmphasized = false;
                }

                if (lastEmphasizedPrimitiveCurve != null)
                {
                    var primCurveData = NewPrimitiveCurvesControl.GetPrimitiveCurve(lastEmphasizedPrimitiveCurve);
                    primCurveData.IsUserAssignment = true;
                    primCurveData.AssignedTo       = lastEmphasizedSketchCurve;
                    var npcControl = lastEmphasizedPrimitiveCurve.VisualPathUp().OfType <NewPrimitiveCurvesControl>().First();
                    eventAggregator.GetEvent <PrimitiveCurvesChangedEvent>().Publish(npcControl.Primitive);
                }
                lastEmphasizedSketchCurve = null;
            }