【发布时间】:2013-04-18 17:28:25
【问题描述】:
我已经在背景中设置了画布并添加了一些图像片段作为该背景画布的子元素,现在我想将特定的图像控件移动到背景画布的给定 x y 位置,所以我尝试了下面给出的这种代码
bg_Canvas.Children[it].RenderTransform = new TranslateTransform();
TranslateTransform trans = bg_Canvas.Children[it].RenderTransform as TranslateTransform;
DoubleAnimation animation = new DoubleAnimation();
animation.To = 80;
Storyboard.SetTarget(animation, trans);
Storyboard.SetTargetProperty(animation, new PropertyPath(TranslateTransform.XProperty));
Storyboard story = new Storyboard();
story.Children.Add(animation);
story.Begin();
它正在工作,但问题是移动图像控件无法放置在背景画布的正确 x 位置,它一直在从放置图像的位置获取 x 位置,实际上第 0 个 x 位置从放置在画布上的图像控件开始,所以我需要设置背景画布的 x 位置以放置图像控件。如果有人知道,我该如何解决这个问题,请告诉我解决方案。
【问题讨论】:
标签: windows-phone-7 translate-animation