Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Unexpected Result From TransformGroup Created in Code
2 replies. Latest Post by ld1453 on July 2, 2009.
(0)
ld1453
Member
284 points
112 Posts
07-01-2009 6:35 PM |
Hello, I've made an animation in both code and XAML that I think should have the same effect but don't. I don't believe the difference is a direct result of the animation but more likely where a TransformGroup is created that the animation uses.
My goal was to make create a new TransformGroup in the RenderTransform of the the control to be animated so that if there were any existing Transform I wouldn't mess it up. Sort of going from this
<ObjectToTransform> <ObjectToTransform.RenderTransform> <TransformGroup> <!-- Existing Transforms --> </TransformGroup> </ObjectToTransform.RenderTransform> </ObjectToTransform>
to this <ObjectToTransform> <ObjectToTransform.RenderTransform> <TransformGroup> <!-- Existing Transforms --> <TransformGroup x:Name="MyIdentifier"> <!-- My Transforms --> </TransformGroup> </TransformGroup> </ObjectToTransform.RenderTransform> </ObjectToTransform>
<ObjectToTransform> <ObjectToTransform.RenderTransform> <TransformGroup> <!-- Existing Transforms --> <TransformGroup x:Name="MyIdentifier"> <!-- My Transforms --> </TransformGroup> </TransformGroup> </ObjectToTransform.RenderTransform> </ObjectToTransform>
When the TransformGroup with Name "MyIdentifier" is created in XAML everything occurs as expected, but if it's made and added in code the result is very different. Does anybody know why this would happen?If anybody is interested and needs more information I wouldn't mind putting in the effort to recreate it in a separate project for you.
nirav_20...
274 points
105 Posts
07-02-2009 2:50 AM |
Can u write few lines about how you are assigning transform values programmatically. I doubt the type casting of transform object to be improper. Sp please give me some more data about ur problem so that I can assist you better.
Regards,
Nirav
07-02-2009 11:53 AM |
Thank for responding Nirav. I reproduced my problem in another project to show you and I found my problem. My transform wasn't working as expected because of the order I was adding the transformations to the TransformGroup. I needed to add the ScaleTransform before the TranslateTransform. Thanks for your help. My new rule is going to be reproduce my question in another project before posting.