【发布时间】:2016-11-29 14:42:55
【问题描述】:
我想在 MapPolygon 的 FillColor 属性上使用 ColorAnimation。
我用BingMap UWP 控件创建了一个热图
Heatmap Preview
我有一个函数,我为每个MapPolygon 计算一个新的FillColor。我现在想使用 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 的第二个参数尝试了很多值...没有任何效果。
我错过了什么?
【问题讨论】: