简体   繁体   中英

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

<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

  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.

MapControl children (the stuff between <MapControl> ... </MapControl> ) are XAML elements that will always be guaranteed to render. 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. You can also hook into this click event to detect when a MapElemet (MapIcon, MapPolygon, or MapPolyline) has been tapped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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