在 UWP Bing 地图中为 MapIcon 纬度值指定 PropertyPath

Specifying PropertyPath for a MapIcon Latitude value in UWP Bing Maps

我正在尝试在 Bing 地图的 UWP 版本中为 MapIcon 的位置设置动画。我在为用作图标中心值的 GeoPointLatitude 组件(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();

None 注释掉的语句有效;它们都会导致 "Cannot resolve TargetProperty on specified object" 错误。我对第一次尝试特别有希望"(MapIcon.Location)(Geopoint.Position)(BasicGeoposition.Latitude)",但没有成功。

(我能够成功地为 MapIcon 的 Color 属性设置动画。)

Storyboard.SetTargetProperty 以应用动画的依赖项 属性 为目标。所以,你想把动画应用到'Latitude'是不可能的。

你必须自己做。例如,使用 DispatcherTimer.