RotateManipulator help please

Dec 14, 2011 at 4: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.

Coordinator
Dec 14, 2011 at 7:26 PM

use the SetBinding method

http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.setbinding.aspx

Dec 15, 2011 at 10: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