我想在MapPolygon的FillColor属性上使用ColorAnimation。如何为MapPolygon(BingMap MapControl)的FillColor设置动画UWP
我创建了一个热图与BingMap
控制UWP Heatmap Preview
我有一个功能,我在那里计算新FillColor
每个MapPolygon
。我现在要使用ColorAnimation
而不是将FillColor
从旧值更改为新值。
//Instead of
statePolygon.FillColor = backGroundColor;
//I want to use something like the following
Storyboard storyboard = new Storyboard();
ColorAnimation animation = new ColorAnimation();
animation.From = statePolygon.FillColor;
animation.To = newBackGroundColor;
animation.Duration = new Duration(new TimeSpan(0, 0, 0, 5));
storyboard.Children.Add(animation);
Storyboard.SetTargetProperty(animation, "(MapPolygon.FillColor)");
Storyboard.SetTarget(myStoryboard, statePolygon);
storyboard.Begin();
但随着故事板代码,我总是得到一个System.Runtime.InteropServices.COMException
这告诉我没有指定动画目标。
我尝试了很多Storyboard.SetTargetproperty
的第二个参数值...没有任何工作。
我错过了什么?
thx很多:)它现在工作。 SetTarget中的myStoryboard是我在xaml中创建的Storyboard,并且忘记更改它。 – David198