使用c#在Windows商店应用中创建动画

时间:2012-11-08 13:04:06

标签: c# windows-store-apps

我在网格中有一个usercontrol,我想用动画重新定位400像素。 我可以使用以下代码重新定位它而不需要动画。

ucChat.Margin = new Thickness(0, -400, 0, 0);

我尝试使用以下代码为其设置动画,但我得到了一个异常

DoubleAnimation da = new DoubleAnimation();
da.Duration = new Duration(TimeSpan.FromMilliseconds(1500));
da.From = 0;
da.To = -400;

Storyboard st = new Storyboard();
Storyboard.SetTarget(da, ucChat);
Storyboard.SetTargetProperty(da, "ucChat.Margin.Top");
st.Children.Add(da);

st.Begin();

Regenwormen.exe中出现“System.Exception”类型的异常,但未在用户代码中处理 WinRT信息:无法解析指定对象上的TargetProperty ucChat.Margin.Top。

有没有人知道如何解决这个或我需要使用什么动画? (厚度动画在Windows应用商店中并不存在)

0 个答案:

没有答案