<RotateTransform3D CenterX="0" CenterY="0" CenterZ="0">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0,1,0" Angle="35"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
For above C# code, I want to set the value of Angle
by my c# code (.cs) instead of xaml.
So I change it like below:
<AxisAngleRotation3D Axis="0,1,0" Angle="AngleValue"/>
And in my cs code:
public partial class Window1 : Window
{
int AngleValue;
public Window1()
{
InitializeComponent();
var t = new DispatcherTimer();
// 1 second
t.Interval = new TimeSpan(0, 0, 1);
t.Tick += RotatePhoto;
t.IsEnabled = true;
t.Start();
}
private void RotatePhoto(object sender, EventArgs e)
{
//var current = this.myViewport3D.Children[0];
//var translate = (current.Transform as Transform3DGroup).Children[0] as TranslateTransform3D;
AngleValue++;
}
But then VS told me that "Input string was not in a correct format
". Could anyone tell me how to do it?
More:
I change my XAML code like:
<AxisAngleRotation3D Axis="0,1,0" Angle="{Binding ElementName=Window1, Path=AngleValue}"/>
But the photo is static (won't rotate at all)...