Silverlight的绑定到TranslateX [英] Silverlight Binding to TranslateX

查看:198
本文介绍了Silverlight的绑定到TranslateX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的应用程序winphone7,但我认为这将适用于任何Silverlight。

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

基本上我有一个椭圆形,我想它与翻译的X和Y属性移动。这里是我的尝试:

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>

我是pretty确保绑定设置正确;问题是,它给了我这个错误,当我运行应用程序:

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

2260发生了错误。 [行:4位置:33]

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

这是一个XAML错误。该错误消失,当我注释掉composittransform线。

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

任何人都可以点我在正确的方向?如果您需要更多code让我知道,我会后多了起来。

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

感谢

推荐答案

的Windows Phone 7目前基于Silverlight的3运行时没有Silverlight 4的。

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

一个在Silverlight 3的限制是,你只能绑定到从 FrameworkElement的派生的元素。该转换类不从 FrameworkElement的得出,因此不能参与结合。

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.

这篇关于Silverlight的绑定到TranslateX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆