views:

163

answers:

1

Hello,

I am a beginner in Silverlight and C# programming and i´m creating a Bing Map application.

I try to add pushpins with coordinates and information from a SQL Server, but I can't figure out how to succeed.

Mike

A: 

I have added push pins with the code below using latitude and longitude.

XAML markup:

<Grid x:Name="LayoutRoot" Background="White">
    <m:Map x:Name="myMap" CredentialsProvider="<Your Key>" Mode="Road"/>
</Grid>

Code to add the push pin with a tooltip:

var location = new Location(latitude, longitude);
var pin = new Pushpin {Location = location};
pin.SetValue(ToolTipService.ToolTipProperty, new TextBlock{Text = "Hello World"});
myMap.Children.Add(pin);

I hope this helps. Please mark this as the answer if it fixes your issue.

Cheers!

Justice
Thank you, it helps me a bit but not all the way. I don´t know how to get the coordinates from my SQL Server.
Mike