Bing Maps for Windows Phone 7


Bing Maps portal helps to find the track of your location worldwide through Windows Phone 7. It binds Private key pair from www.bingmapsportal.com & find a private key from https://www.bingmapsportal.com/application/ by  providing your live ID & application name & URL.

Use the private key pair to use it your code. If you have downloaded the Windows Phone 7 Training kit then check the BingMaps lab. Check the Ex-1 Bing Maps Control , Find Begin Then start code.

In App.Xaml.Cs , Add the BingMaps Private key:

internal const string Id = "type your Private Key"; 

In MainPage.Xaml add Maps Control & Add the corresponding Maps data-binding:
<my:Map Name="Map" Height="756" Width="480" CredentialsProvider="{Binding CredentialsProvider}" 
CopyrightVisibility="Collapsed" LogoVisibility="Collapsed" ZoomLevel="{Binding Zoom,Mode=TwoWay}" 
Center="{Binding Center,Mode=TwoWay}">

            <my:Map.Mode>
                <my:AerialMode ShouldDisplayLabels="True" />
            </my:Map.Mode>

            <Button x:Name="ButtonZoomIn" 
                    Style="{StaticResource ButtonZoomInStyle}"
                    HorizontalAlignment="Left" VerticalAlignment="Top"
                Height="56" Width="56" Margin="8,180,0,0"  Click="ButtonZoomIn_Click"/>

        <Button x:Name="ButtonZoomOut" 
                Style="{StaticResource ButtonZoomOutStyle}"
                HorizontalAlignment="Left" VerticalAlignment="Top" Height="56" Width="56" 
Margin="8,260,0,0" Click="ButtonZoomOut_Click" />

        </my:Map>

in Code-Behind add: 
private double _zoom;

        private const double DefaultZoomLevel = 18.0;
        private const double MaxZoomLevel = 21.0;
        private const double MinZoomLevel = 1.0;
        private static readonly GeoCoordinate DefaultLocation = new GeoCoordinate(47.639631, -122.127713);
        private GeoCoordinate _center;

        #endregion

        #region Fields

        private readonly CredentialsProvider _credentialProvider = new ApplicationIdCredentialsProvider(App.Id);
        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the map zoom level.
        /// </summary>
        public double Zoom
        {
            get { return _zoom;}
            set
            {
                var coercedZoom = System.Math.Max(MinZoomLevel, System.Math.Min(MaxZoomLevel, value));
                if (_zoom != coercedZoom)
                {
                    _zoom = value;
                    NotifyPropertyChanged("Zoom");
                }
            }

        }
 public CredentialsProvider CredentialsProvider
        {
            get { return _credentialProvider; }
        }

// To change the map-mode from Aerial View to Road View:
private void ChangeMapMode()
        {
            // TODO : Change map view mode.
            if (Map.Mode is AerialMode)
            {
                Map.Mode = new RoadMode();
            }
            else
            {
                Map.Mode = new AerialMode(true);
            }

        }
Now GPS navigation functionality with BingMaps portal is available in your Windows Phone.

This slideshow requires JavaScript.

Advertisements

About Anindita
Anindita Basak is working as Big Data Cloud Consultant in Microsoft. Worked in multiple MNCs as Developer & Senior Developer on Microsoft Azure, Data Platform, IoT & BI , Data Visualization, Data warehousing & ETL & of course in Hadoop platform.She played both as FTE & v- employee in Azure platform teams of Microsoft.Passionate about .NET , Java, Python & Data Science. She is also an active Big Data & Cloud Trainer & would love share her experience in IT Training Industry. She is an author, forum contributor, blogger & technical reviewer of various books on Big Data Hadoop, HDInsight, IoT & Data Science, SQL Server PDW & PowerBI.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: