Skip to Content
Mastering Xamarin.Forms - Second Edition
book

Mastering Xamarin.Forms - Second Edition

by Ed Snider
March 2018
Intermediate to advanced content levelIntermediate to advanced
192 pages
4h 4m
English
Packt Publishing
Content preview from Mastering Xamarin.Forms - Second Edition

Using the location service on the new entry page

Now that we have an interface that defines our location service, we can use it in the core project of our TripLog app. The main place we will need to capture location in the app is on the new entry page, so coordinates can be attached to log entries when they are added. Since we want to keep our app logic separate from the user interface, we will use the location service in the new entry page's ViewModel, and not on the page itself.

In order to use the ILocationService interface in the NewEntryViewModel, perform the following steps:

  1. First, add a read-only property to the NewEntryViewModel to hold an instance of the location service:
      public class NewEntryViewModel : BaseViewModel      {          readonly ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Xamarin.Forms - Third Edition

Mastering Xamarin.Forms - Third Edition

Ed Snider
Xamarin.Forms Projects - Second Edition

Xamarin.Forms Projects - Second Edition

Daniel Hindrikes, Johan Karlsson
Xamarin.Forms Projects

Xamarin.Forms Projects

Johan Karlsson, Daniel Hindrikes

Publisher Resources

ISBN: 9781788290265Supplemental Content