【发布时间】:2019-02-06 00:09:54
【问题描述】:
我正在尝试在 UWP 版本的 Bing 地图中为 MapIcon 的位置设置动画。我在为用作图标中心值的GeoPoint 的Latitude 组件(double 值)指定PropertyPath 时遇到问题:
MapIcon mapIcon1 = new MapIcon();
mapIcon1.Location = myMap.Center;
mapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0);
mapIcon1.Title = "My Friend";
mapIcon1.Image = mapIconStreamReference;
mapIcon1.ZIndex = 0;
myMap.MapElements.Add(mapIcon1);
double centerLatitude = myMap.Center.Position.Latitude;
double centerLongitude = myMap.Center.Position.Longitude;
Storyboard storyboard = new Storyboard();
DoubleAnimation animation = new DoubleAnimation();
animation.From = centerLatitude;
animation.To = centerLatitude + 100f;
animation.Duration = new Duration(new TimeSpan(0, 0, 0, 5));
animation.EnableDependentAnimation = true;
storyboard.Children.Add(animation);
//Storyboard.SetTargetProperty(animation, "(MapIcon.Location)(Geopoint.Position)(BasicGeoposition.Latitude)");
//Storyboard.SetTargetProperty(animation, "(MapIcon.Location)(MapControl.Center)(Geopoint.Position)(BasicGeoposition.Latitude)");
//Storyboard.SetTargetProperty(animation, "(MapIcon.Location)(BasicGeoposition.Latitude)");
//Storyboard.SetTargetProperty(animation, "(MapIcon.Location.Latitude)");
Storyboard.SetTarget(storyboard, mapIcon1);
storyboard.Begin();
注释掉的语句都不起作用;它们都导致“无法解析指定对象上的 TargetProperty”错误。我特别希望第一次尝试"(MapIcon.Location)(Geopoint.Position)(BasicGeoposition.Latitude)",但没有运气。
(我能够成功地为 MapIcon 的 Color 属性设置动画。)
【问题讨论】:
-
嗨!您找到任何可行的解决方案了吗?请您介意与我们分享一下吗?
-
@DmitryBoyko 正如下面的答案所示,这在当时是不可能的,我放弃并继续前进。不知道从那以后它是否改变了。谢谢。
标签: c# animation uwp bing-maps uwp-maps