Hi, i have created a viewer that generates a mesh from a separate file. In this viewer I would like to be able to scale the mesh with a transform based on three sliders (x,y,z).
If i have the transform in the window-class everything goes well, the bindings in that case are as followed (slideX being the slider in XAML, width/height = scale of the mesh):
Transform3DGroup transGroup = new Transform3DGroup();
ScaleTransform3D scalex = new ScaleTransform3D(1f, 1f, 1f, ((float)width) / 2, ((float)(height) / 2) / 2, 0f);
Binding bindingx = new Binding();
bindingx.Source = slideX;
bindingx.Path = new PropertyPath("Value");
bindingx.Mode = BindingMode.TwoWay;
BindingOperations.SetBinding(scalex, ScaleTransform3D.ScaleYProperty, bindingx);
transGroup.Children.Add(scalex);
The problems comes when i no longer can keep the transformation in this class. If i still keep the transformation in the window-class i cant find the correct ModelVisual3D to attach it to (it might not exist/been loaded yet) And if i move the transformation to the "mesh-creating" class i cant find the sliders.
Any ideas?
Best regards!