Binding Bing Maps.


  • Hello,

    I have a SilverLight Application that contain a Bing map , and i have a database that contain tables one of them like this:

    Customers (ID,Name,Lat,long)

    i want to show a Pushin on the map for each Customer , i followed these tutorial :

    Binding BingMaps

    but in the tutorial he uses a XML file instead of database connection, how can i reach the same result with Database Connection  , or if there is a better way to do this that the link above. Thanks

    Wednesday, March 28, 2012 1:20 AM


All replies

  • Take a look at this codeplex project: It makes it easy to connect a Silverlight Bing Maps application to a database.

    Wednesday, March 28, 2012 7:15 PM
  • Thank you for your answer , but i don't have problem connecting to Database i used a ' silverlight-enabled service' and i put a methode like this:

     public DataTable GetCustomers()
            string conn = ConfigurationManager.ConnectionStrings["ConnectToDB"].ConnectionString;
            DataTable dataTable;
            SqlDataAdapter dataAdapter = new SqlDataAdapter();
            using (SqlConnection connection = new SqlConnection(conn))
                using (SqlCommand cmd = new SqlCommand())
                    cmd.CommandText = "select ID,Name,Lat,Long from Customer";
                    cmd.Connection = connection;
                    dataAdapter.SelectCommand = cmd;
                    dataTable = new DataTable();
            return dataTable;

    but my problem is how to bind the result from this method to use it in this:

            <DataTemplate x:Key="LogoTemplate">
                <m:Pushpin m:MapLayer.Position="{Binding ????}" >
                    <ToolTipService.ToolTip >
                        <TextBlock Text="{Binding ????}"></TextBlock>
            <t:LocationDataCollection x:Key="LocationList" IsDataSource="True"/>

    i.e what should i insert in position of '????' . I hope i made my problem clear. Thanks.

    Wednesday, March 28, 2012 9:37 PM
  • I have created a bing map application under silverlight4.0, MSVS 2010.

    I want to connect my bing map application with database,I think wcf ria service will be applicable,

    Actually, want to store latitude, longitude and image(i.e icon placed on that location on button click) on button click.After that i also want to apply following operations i.e select, update, delete etcc.

    Any Help?

    • Edited by amit1989 Thursday, April 12, 2012 11:53 AM
    Thursday, April 12, 2012 11:51 AM