1
votes

I have a WP7 bing map with pushpin locations reading from an XML.

The way ive done it seems different from many of the tutorials ive read, as im using a map:layer and in the c# im adding pushpins to this map layer.

My problem is I cant find how to 1. Custom image for the pushpin (all pins will have the same image) 2. Clickable pushpin which either goes to an event handler and method showing you the info for that pin from the xml source, or to just pop up an image when you click on the pushpin.

XAML: maps:MapLayer x:Name="QuakeLayer"

C#

     QuakeLayer.Children.Clear();


        foreach (var ev in events)
        {
            var accentBrush = (Brush)Application.Current.Resources["PhoneAccentBrush"];

            var pin = new Pushpin
            {
                Location = new GeoCoordinate
                {
                    Latitude = ev.Latitude,
                    Longitude = ev.Longitude
                },
                Background = accentBrush,



            };

            QuakeLayer.AddChild(pin, pin.Location);

Any advice welcome. Thank you.

1

1 Answers

1
votes

You can have a template for your custom pushpin + use the manipulation event to handle the click, see my answer on this question, there's an example with a datatemplate: How should I handle click events on pushpins in my Bing Maps control for WP7