Translate transform in code
-
I have a class which builds cubes.One of its properties is to translate to diffrent part of the screen. testCube is object of that class. testCube.Translate = new TranslateTransform3D(0, -1, 1); I would like to set binding for Translation, but I am having hard time. Looking the book WPF in Action I found this code for Rotation. AxisAngleRotation3D angleRot = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0); RotateTransform3D rot = new RotateTransform3D(angleRot,new Point3D(-spaceToUseX + (spaceToUseX / 2), 0, -(barWidth / 2))); Binding rotBind = new Binding("Value"); rotBind.Source = rotateSlider; BindingOperations.SetBinding(angleRot, AxisAngleRotation3D.AngleProperty, rotBind); model.Transform = rot; I wrote this code, but nothing happends.It runs, with no errors Binding TransformBindingX = new Binding("CubeUnit"); TransformBindingX.Path = new PropertyPath("Translate.OffsetX"); Binding TransformBindingY = new Binding("CubeUnit"); TransformBindingY.Path = new PropertyPath("Translate.OffsetY"); Binding TransformBindingZ = new Binding("CubeUnit"); TransformBindingZ.Path = new PropertyPath("Translate.OffsetZ"); TranslateTransform3D translateTransform3D = new TranslateTransform3D(); BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetXProperty, TransformBindingX); BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetYProperty, TransformBindingY); BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetZProperty, TransformBindingZ); Any Idea? Best regards Agha