O'Reilly logo

Programming Windows Store Apps with C# by Iris Classon, Matthew Baxter-Reynolds

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Location

In all geo-capable apps, regardless of platform, there are three things you as a developer typically want to do. You want to determine where an asset is, present the user with some sort of visualization of location, or tag an activity to a point in space (and usually along with it a point in time). In this chapter, we’re going to look primarily at the latter two. Although we’ll also look briefly at getting a device’s location, I’m keeping that discussion short because it’s fairly straightforward and applies only in limited cases. However, we’ll focus on mapping because a) it’s helpful, and b) it’s actually pretty cool! (My advice, if you want to sell a prototype project to your boss, is to put a map in it.)

We’ll achieve the presentation of the actual maps by integrating Bing Maps. You will need a developer key to do this, but I’ll go through that when we get to it. Before we do all that, though, we have to modify the app so that we actually have somewhere to present a map.

Creating a Singleton View

To start the work that we need to do in this chapter, we need a page that we can put a map on. We’ll create a singleton view that will display a single report from the local database. From a UI perspective we’ll design this in classic Windows 8 style: a viewport that scrolls horizontally, presenting a “panorama” across the presentation. This will require us to use a ScrollViewer and a Grid.

In XAML, a ScrollViewer is—as its name implies—a control that implements scrolling. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required