private void ResetHeading(object sender, MouseButtonEventArgs e) { CameraHeadingControl.Value = 0; BindingExpression binding = CameraHeadingControl.GetBindingExpression(Slider.ValueProperty); binding.UpdateSource(); }
private void Polygon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { //Disable moving mouse to change the value. _isPressed = false; BindingExpression binding = CameraHeadingControl.GetBindingExpression(Slider.ValueProperty); binding.UpdateSource(); }
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(); } }