指定的PropertyPath在UWP Bing地图一MapIcon纬度值

问题描述 投票:0回答:1

我试图在动画Bing地图的UWP版本MapIcon的位置。我有指定为用作图标中心值的PropertyPathLatitude组分(a double值)GeoPoint问题:

        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的颜色属性。)

c# animation uwp bing-maps uwp-maps
1个回答
2
投票

Storyboard.SetTargetProperty针对其中动画的应用依赖项属性。所以,你想要什么应用动画“Latitude'is不可能的。

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

© www.soinside.com 2019 - 2024. All rights reserved.