Developer
Developer

Reputation: 4321

Windows Phone 8 maps

I have next XAML:

<maps:Map x:Name="MyMap"  HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="410" Width="436" CartographicMode="Hybrid">
            <toolkit:MapExtensions.Children>
                <toolkit:Pushpin Visibility="Collapsed" x:Name="pushpin" Content="My Position"/>
            </toolkit:MapExtensions.Children>
        </maps:Map>

And here is my C# code:

string[] tmp = result.ToString().Split(' ');
        MyMap.Center = new GeoCoordinate(double.Parse(tmp[0]), double.Parse(tmp[1]));
        MapLayer layer0 = new MapLayer();
        Pushpin pushpin0 = new Pushpin();
        pushpin0.Visibility = Visibility.Visible;
        pushpin0.GeoCoordinate = new GeoCoordinate(double.Parse(tmp[0]), double.Parse(tmp[1]));
        MapOverlay overlay0 = new MapOverlay();
        overlay0.Content = pushpin0;
        overlay0.GeoCoordinate = new GeoCoordinate(double.Parse(tmp[0]), double.Parse(tmp[1]));
        layer0.Add(overlay0);

My pushpin doesn't show up on the map, what i'm missing here?

Upvotes: 1

Views: 288

Answers (2)

shanthi_karthika
shanthi_karthika

Reputation: 925

Refer the following link http://mendez.quora.com/Working-with-Pushpins-and-Maps-in-Windows-Phone-8 Good Luck

Upvotes: 0

Kajzer
Kajzer

Reputation: 2385

I belive you forgot to add the layer to the map:

MyMap.Layers.Add(layer0);

Upvotes: 1

Related Questions