private void Polygon_MouseMove(object sender, MouseEventArgs e) { if (_isPressed) { //Find the parent canvas. if (_templateCanvas == null) { _templateCanvas = CameraHeadingHelper.FindParent <Canvas>(e.Source as Ellipse); if (_templateCanvas == null) { return; } } //Calculate the current rotation angle and set the value. Point newPos = e.GetPosition(_templateCanvas); double angle = CameraHeadingHelper.GetAngleR(newPos, RADIUS); CameraHeadingControl.Value = (CameraHeadingControl.Maximum - CameraHeadingControl.Minimum) * angle / (2 * Math.PI); BindingExpression binding = CameraHeadingControl.GetBindingExpression(Slider.ValueProperty); binding.UpdateSource(); } }