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

Updating MainViewModel

In order to move the navigation functionality from MainPage to MainViewModel, we will need to add two new Command properties—one for creating a new log entry and another for viewing the details of an existing log entry:

      public class MainViewModel : BaseViewModel      {          // ...          Command<TripLogEntry> _viewCommand;          public Command<TripLogEntry> ViewCommand           {              get               {                    return _viewCommand                      ?? (_viewCommand = new Command<TripLogEntry>(async (entry) => await ExecuteViewCommand(entry)));               }          }          Command _newCommand;          public Command NewCommand           {              get               {                  return _newCommand                      ?? (_newCommand = new Command(async () => await ExecuteNewCommand()));               }           }          async Task ExecuteViewCommand(TripLogEntry entry)          { await NavService.NavigateTo<DetailViewModel, ...
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