views:

84

answers:

1

I have a simple winphone7 application, but I think this would apply to any silverlight.

Basically I have an ellipse and I would like to move it with the translate X and Y properties. Here is my attempt:

<Ellipse Fill="#FFF4F4F5" Margin="0,0,-3,-3" Stroke="Black" RenderTransformOrigin="0.5,0.5" >
            <Ellipse.RenderTransform>
                <CompositeTransform TranslateY="{Binding Y}" TranslateX="{Binding X}"/>
            </Ellipse.RenderTransform>
</Ellipse>

I am pretty sure the Binding is set correctly; The problem is it gives me this error when I run the application:

2260 An error has occurred. [Line: 4 Position: 33]

which is a XAML error. The error goes away when I comment out the composittransform line.

Can anyone point me in a right direction? If you need more code let me know, i'll post more up.

Thanks

+2  A: 

Windows Phone 7 is currently based on the Silverlight 3 runtime not Silverlight 4.

One of the limitations in Silverlight 3 is that you can only bind to an element that derives from FrameworkElement. The transform classes do not derive from FrameworkElement and hence cannot participate in binding.

Instead of moving the ellipse via binding consider using a Storyboard to animate the transform instead.

AnthonyWJones
ah, thanks for that. I will give some storyboard things a try when I get home this evening.
Peanut