Click here to Skip to main content
15,895,777 members
Articles / Mobile Apps / Windows Phone 7

Bing Maps in Windows Phone

Rate me:
Please Sign up or sign in to vote.
3.60/5 (6 votes)
9 Nov 2012CPOL1 min read 39.3K   1.5K   7  
Using Bing Maps in Windows Phone 7
using System;
using System.Windows;
using Microsoft.Phone.Controls;

namespace BingMapsDemoV1
{
    public partial class PushpinProperties : PhoneApplicationPage
    {
        public PushpinProperties()
        {
            InitializeComponent();
        }

        private void addPin_Click(object sender, RoutedEventArgs e)
        {
            double longitude;
            double latitude;
            try
            {
                longitude = double.Parse(longitudeTB.Text.ToString());
                latitude = double.Parse(LatitudeTB.Text.ToString());
                SharedInformation.pinLong = longitude;
                SharedInformation.pinLat = latitude;
                SharedInformation.pinContent = textBox1.Text;

                MessageBox.Show("Your Pushpin was successfully set!");
                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            }
            catch (Exception exc)
            {
                MessageBox.Show("Please enter a valid location!" + exc.Message);
            }
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Microsoft
Tunisia Tunisia
I'm a Software Engineer and MVP (Client Development). I like writing articles and developing open source software in C#, Windows Phone and Windows 8 applications droidcon.tn/speakers.php.
http://houssemdellai.net

Comments and Discussions