Before reading this article, please go through the following article.
In this article, you will learn how to use Button Control, TextBlock control, and TextBox Control in Visual C# environment. Also, you will be able to develop a simple arithmetic calculation app in Universal Windows Apps development, using XAML and Visual C#.
The following important tools are required for developing a UWP application,
- Windows 10 (Recommended).
- Visual Studio 2015 Community Edition (It is a free software available online).
Now, we can discuss the step by step App development.
If you are new to Map control component, I suggest you learn the following article.
In this article we will see about how to set a street view experience
Step 1: Open the already created project called "Mapsample" that is created and deployed in your machine or create a new Universal application by following the above link.
Step 2: Open MainPage.Xaml.cs and add the following code as shown below for creating an Aerial.
Aerial 3D code is given below,
- Mapsample.Style = MapStyle.Aerial3D;
Overall code for setting aerial code is,
- private async void Mapsample_Loaded(object sender, RoutedEventArgs e)
- {
-
- var center =
- new Geopoint(new BasicGeoposition()
- {
- Latitude = 11.66509,
- Longitude = 78.154587
-
- });
-
-
- await Mapsample.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 3000));
-
- Mapsample.Center =
- new Geopoint(new BasicGeoposition()
- {
- Latitude = 11.66509,
- Longitude = 78.154587
- });
-
- Mapsample.ZoomLevel = 16;
-
-
- if (Mapsample.Is3DSupported)
- {
-
- Mapsample.Style = MapStyle.Aerial3D;
-
-
-
- var mapScene = MapScene.CreateFromLocationAndRadius(Mapsample.Center, 500, 90, 45);
- await Mapsample.TrySetSceneAsync(mapScene);
- }
- }
Entire code is in Xaml.cs,
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Runtime.InteropServices.WindowsRuntime;
- using Windows.Devices.Geolocation;
- using Windows.Foundation;
- using Windows.Foundation.Collections;
- using Windows.UI.Xaml;
- using Windows.UI.Xaml.Controls;
- using Windows.UI.Xaml.Controls.Maps;
- using Windows.UI.Xaml.Controls.Primitives;
- using Windows.UI.Xaml.Data;
- using Windows.UI.Xaml.Input;
- using Windows.UI.Xaml.Media;
- using Windows.UI.Xaml.Navigation;
-
-
-
- namespace Mapsample
- {
-
-
-
- public sealed partial class MainPage : Page
- {
- public MainPage()
- {
- this.InitializeComponent();
- Mapsample.Loaded += Mapsample_Loaded;
- }
-
- private async void Mapsample_Loaded(object sender, RoutedEventArgs e)
- {
-
- var center =
- new Geopoint(new BasicGeoposition()
- {
- Latitude = 11.66509,
- Longitude = 78.154587
-
- });
-
-
- await Mapsample.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 3000));
-
- Mapsample.Center =
- new Geopoint(new BasicGeoposition()
- {
- Latitude = 11.66509,
- Longitude = 78.154587
- });
-
- Mapsample.ZoomLevel = 16;
-
-
- if (Mapsample.Is3DSupported)
- {
-
- Mapsample.Style = MapStyle.Aerial3D;
-
-
-
- var mapScene = MapScene.CreateFromLocationAndRadius(Mapsample.Center, 500, 90, 45);
- await Mapsample.TrySetSceneAsync(mapScene);
- }
- }
-
- }
-
- }
-
Output