RotateManipulator help please

Dec 14, 2011 at 3:41 PM

I am attempting to code a RotateManipulator in C# codebehind (not xaml) to add rotateable and translateable planes on a double click event.

How would this line from ManipulatorDemo / MainWindow.xaml line 185 be coded in c#?

<ht:RotateManipulator Color="Blue" Axis="0,0,1" Transform="{Binding Transform, ElementName=plane2}" TargetTransform="{Binding Transform, ElementName=plane2}" Diameter="1"/>

It is the syntax of the binding transforms that I am struggling with (I am new to wpf if you haven't guessed)

Thanks! badgerbadger.

Dec 14, 2011 at 6:26 PM

use the SetBinding method

Dec 15, 2011 at 9:11 AM

Thanks, I had been using that but not getting it to work. Attempted to code ManipulatorDemo / MainWindow.xaml line 185 as

var plane = new RectangleVisual3D();

plane. etc

var manip = new RotateManipulator();


BindingOperations.SetBinding(manip, RotateManipulator.TransformProperty, new Binding("Transform") { ElementName = "plane" });
BindingOperations.SetBinding(manip, RotateManipulator.TargetTransformProperty, new Binding("Transform") { ElementName = "plane" });

and other combinations of setBinding but get "System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=plane'"...

Apologies if this is a newbie wpf error but not finding much relevant on the web