Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Xamarin.Forms

You're reading from   Mastering Xamarin.Forms Build rich, maintainable multiplatform native mobile apps with Xamarin.Forms

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781785287190
Length 184 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ed Snider Ed Snider
Author Profile Icon Ed Snider
Ed Snider
Arrow right icon
View More author details
Toc

Creating a navigation service

In a typical cross-platform mobile app architecture, one would have to implement a platform-specific navigation service for each platform the app supports. In our case, Xamarin.Forms has already done this, so we're simply going to implement a single navigation service that extends the Xamarin.Forms navigation abstraction so we can perform ViewModel to ViewModel navigation.

The first thing we need to do is define an interface for our navigation service that will define its methods. We are starting with an interface so the service can be added to ViewModels via constructor injection, which we'll dive into in Chapter 4, Platform Specific Services and Dependency Injection. We are also starting with an interface so we can easily provide alternative implementations of the service without changing ViewModels that depend on it. A common scenario for this is creating a mock of the service that gets used when unit testing ViewModels.

In order to create the navigation...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image