简体   繁体   English

Windows Phone 8.1中的MapIcon

[英]MapIcon in windows phone 8.1

I have search lots of things about maps control in windows phone 8.1(RT), but I didn't get things about how to set MapIcon in xaml I have found following thing in MSDN but I don't know how it works 我在Windows Phone 8.1(RT)中搜索了很多有关地图控件的内容,但是我没有得到有关如何在xaml中设置MapIcon的信息,我在MSDN中发现了以下内容,但我不知道它是如何工作的

<maps:MapControl>
<TextBox Text="Seattle" maps:MapControl.Location="{Binding SeattleLocation}"/>
<TextBox Text="Bellevue" maps:MapControl.Location="{Binding BellevueLocation}"/>

now my questing is I want two MapIcon one is Source Address Icon and Secon is Destination Icon , when I click/tapped map the Icon should visible on map I have tried it on Runtime 现在我的任务是我想要两个MapIcon,一个是Source Address Icon,另一个是Secon是Destination Icon,当我单击/点击地图时,该图标应该在地图上可见,我已经在运行时尝试过了

  sourceIcon = new MapIcon()
            {
                Location = args.Location,
                Title = "You are here!",
                Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Images/pin_red.png")),
                NormalizedAnchorPoint = new Point() { X = 0.5, Y = 0.5 },
            };
            mapLocation.MapElements.Add(sourceIcon);

but it not guarantee that to display . 但它不能保证显示。

MapIcons and MapControl XAML children are different things. MapIcons和MapControl XAML子代是不同的东西。

MapControl children (the stuff between <MapControl> ... </MapControl> ) are XAML elements that will always be guaranteed to render. MapControl子级(介于<MapControl> ... </MapControl>之间的东西)是XAML元素,将始终保证它们呈现。 You can hook into the tap handlers as well. 您也可以连接到轻敲处理程序。

MapIcons may be occluded by other icons and elements on the map, so they are not guaranteed to be displayed. MapIcons可能被地图上的其他图标和元素遮挡,因此不能保证将其显示。 You can also hook into this click event to detect when a MapElemet (MapIcon, MapPolygon, or MapPolyline) has been tapped. 您还可以连接到此 click事件,以检测何时点击了MapElemet(MapIcon,MapPolygon或MapPolyline)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM