在WP8.1项目中,我创建了MapIcon并将其添加到MapElements中。在某些级别的缩放图像是画图,但有时当我放大或缩小它消失(当地名接近图像时我很薄)。这怎么可能解决?提前谢谢!
背后的代码
mapIcon = new MapIcon();
mapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0);
mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/mapIcon.png"));
mapIcon.Title = "You are here!";
MyMapControl.MapElements.Add(mapIcon);
mapIcon.Location = new Geopoint(new BasicGeoposition()
{
Latitude = geoLoc.Latitude,
Longitude = geoLoc.Longitude
});
XAML
<Grid Grid.Row="0" x:Name="ContentRoot" Margin="0,0,0,0">
<Maps:MapControl
x:Name="MyMapControl"
MapServiceToken="<my token>"
ZoomLevel="13.5"
LandmarksVisible="True"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Margin="0,0,0,0"
>
</Maps:MapControl>
</Grid>
答案 0 :(得分:2)
不保证显示MapIcon元素,它们可能被其他元素遮挡,或者它们距离太近。
如果您想要一个始终显示的控件,请使用XAML元素:http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn792121.aspx#showing_xaml_controls_and_shapes_on_the_map