Hi,
I want to make a listbox with 3D items so I have created a DataTemplate which contains the 3D object. In the DataTemplate.Triggers I start an animation to rotate the 3D object on mouse over.
But when I do mouse over an error is raised:
"The value of property 'Transform' in the path '(0).[0].(1).[1].(2).(3).(4)' points an immutable instance of 'System.Windows.Media.Media3D.RotateTransform3D' which may not be manipulated."
I have created a sample project:
http://www.valil.com/winfx/test.zip
Thank you,
Valentin Iliescu

Cannot animate a transform in a data template
Ashwin Murthy MSFT
Here's the relevant parts of my XAML. Attempts to run storyboard s1 result in
System.InvalidOperationException was unhandled
Message="The value of property 'Transform' in the path '(0).[0].(1).(2).[2].(3).(4).[0].(5)' points an immutable instance of 'System.Windows.Media.Media3D.Transform3DGroup' which may not be manipulated."
<ControlTemplate>
<ControlTemplate.Resources>
<Transform3DGroup x:Key="Transform1" >
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Angle="0" Axis="0 1 0"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
<ScaleTransform3D ScaleX="2" ScaleY="2" ScaleZ="2"/>
</Transform3DGroup>
<Storyboard x:Key="s1" TargetName="vp1">
<Rotation3DAnimation Storyboard.TargetProperty="(Viewport3D.Children)[0].(ModelVisual3D.Content).(Model3DGroup.Children)[2].(Model3DGroup.Transform).(Transform3DGroup.Children)[0].(RotateTransform3D.Rotation)">
</Rotation3DAnimation>
<ControlTemplate.Resources>
<Viewport3D x:Name="vp1">
<ModelVisual3D x:Name="m1">
<ModelVisual3D.Content>
<Model3DGroup x:Name="Scene1"
<AmbientLight .... />
<DirectionalLight .... />
<Model3DGroup x:Name="Obj1" Transform="{DynamicResource Transform1}">
...
</Model3DGroup>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
</Viewport3D>
</ControlTemplate>
Paul Greenfield
Hi Valentin,
The issue here is that the freezable you are trying to change is immutable. Inorder to make it mutable, you need to give a hint to the Template that you want to modify this freezable later and hence it should not freeze it.
In the PDC bits the only way to do this is to put a ResourceReference or a Binding on this freezable. In the Dec CTP bits you can do this by simply putting an x:Name on this freezable which also gives the same hint to the Template.
Hope this helps,
Namita [MSFT]