private void ScaleButton_OnClick(object sender, RoutedEventArgs e)
        {
            var scale = _rnd.NextDouble() * 0.4 + 0.8;

            // Use BeginInit / EndInit to change the transformation only once
            _standardTransform3D.BeginInit();
            _standardTransform3D.ScaleX *= scale;
            _standardTransform3D.ScaleY *= scale;
            _standardTransform3D.ScaleZ *= scale;
            _standardTransform3D.EndInit();
        }
Ejemplo n.º 2
0
        private void GetValuesFromControls()
        {
            _isChangedInternally = true; // Prevent handling Changed event

            StandardTransform3D.BeginInit();

            StandardTransform3D.TranslateX = ParseValue(TranslateXTextBox, StandardTransform3D.TranslateX);
            StandardTransform3D.TranslateY = ParseValue(TranslateYTextBox, StandardTransform3D.TranslateY);
            StandardTransform3D.TranslateZ = ParseValue(TranslateZTextBox, StandardTransform3D.TranslateZ);

            StandardTransform3D.RotateX = ParseValue(RotateXTextBox, StandardTransform3D.RotateX);
            StandardTransform3D.RotateY = ParseValue(RotateYTextBox, StandardTransform3D.RotateY);
            StandardTransform3D.RotateZ = ParseValue(RotateZTextBox, StandardTransform3D.RotateZ);

            StandardTransform3D.ScaleX = ParseValue(ScaleXTextBox, StandardTransform3D.ScaleX);
            StandardTransform3D.ScaleY = ParseValue(ScaleYTextBox, StandardTransform3D.ScaleY);
            StandardTransform3D.ScaleZ = ParseValue(ScaleZTextBox, StandardTransform3D.ScaleZ);

            StandardTransform3D.EndInit();

            _isChangedInternally = false;
        }