私はSilverlightで新しく、オブジェクトの不透明度をプログラムでアニメーション化するサンプルを試しています。Silverlight不透明アニメーションがプログラムで動作しない
私は次のコードを作ってみた:私も試してみたプロパティパスについては
MapShape myTestShape= RadMapInformationLayer.Items[0] as MapShape;
SolidColorBrush brush = new SolidColorBrush();
brush.Color = Colors.Purple;
myTestShape.Fill = brush;
//create a duration object
Duration duration = new Duration(TimeSpan.FromSeconds(5));
//create the storyboard
Storyboard story = new Storyboard();
//create double animation
DoubleAnimation animation = new DoubleAnimation();
//set the duration property
animation.Duration = duration;
//set the from and too values
animation.From = 1.0;
animation.To = 0.0;
//add the duration to the storyboard
story.Duration = duration;
//now set the target of the animation
Storyboard.SetTarget(animation, myTestShape);
//set the target property of this object
Storyboard.SetTargetProperty(animation, new PropertyPath(UIElement.OpacityProperty));
//add the double animations to the story board
story.Children.Add(animation);
if (!LayoutRoot.Resources.Contains("story1"))
LayoutRoot.Resources.Add("story1", story);
story.Begin();
:
1. new PropertyPath("(FrameworkElement.Opacity)")
2. new PropertyPath("(FrameworkElement.Opacity)")
3. new PropertyPath("(Control.Opacity)")
そしていくつかの他、私はゼロ運を持っていますこの。
誰かが間違っているのを誰でも見ることができますか?私は前にMapShape.FillPropertyにデータバインディング行っている
おかげで、 ジャック
コードに問題はありません。実行するとどうなりますか?任意のエラー?例外? – ColinE
コードはRectangleに対して正常に機能します。おそらくこれはMapShapeをアニメートする際の問題です。 – foson
返信ありがとうございますFosonとColinE ColinE:エラーはありません。何もしません。 Foson:MapShapeオブジェクトで、思考が変わるかどうかはわかりませんが、Controlオブジェクトを継承していますか? – Jacques