0

如果在创建图像时指定了对齐,则刚刚遇到了对齐不适用于 WPF Bing Maps 的问题:

var element = new Image()
        {
            Source = ResourceManager.VesselIcon,
            Opacity = 0.9,
            Stretch = System.Windows.Media.Stretch.None,

            VerticalAlignment = System.Windows.VerticalAlignment.Center, // Is not working
            HorizontalAlignment = System.Windows.HorizontalAlignment.Center
        };

Fortunatley WPF Bing Maps API 确实提供了“PositionOrigin”结构。因此,可以在向地图本身添加形状的同时指定对齐方式:

Location location = Helper.SomeLocation();
this.mapLayer.AddChild(element, location, PositionOrigin.Center);

希望它会帮助某人

4

1 回答 1

0

Fortunatley WPF Bing Maps API 确实提供了“PositionOrigin”结构。因此,可以在向地图本身添加形状的同时指定对齐方式:

Location location = Helper.SomeLocation();
this.mapLayer.AddChild(element, location, PositionOrigin.Center);
于 2012-11-04T22:43:49.193 回答