Marc (34) [Avatar] Offline
#1
Hi,
After 50 years as a software engineer I decided to write my first GUI program, so I'm still coming up to speed on the Xamarin ecosystem.
I can see why you chose not to include menus: it seems they would take a book by themselves to cover properly.

Since you do cover Navigation, you may find this question within the scope of this forum:
NavigationDrawer's seem to require Fragments. True or False?
Fragments seem to be small pieces of UI (sub-screens, if you will) that are swapped into a "parent" view.

1. Can I have a code-behind file for a fragment?
2. Can I have a ViewModel for the "parent" view?
3. And the real question: Can I use Mvvm 5.x style Navigation to show other Views entirely from within a Fragment?

Without knowing the innards of the Android OS I have no idea if I would be leaking resources like crazy, leaving stranded views on a stack or other bad things.

My app has a natural flow to it. Navigation will expose the 'next' view/viewmodel pair as appropriate.
The purpose of a Menu is allow the user to 'jump', out of sequence, to any View they choose, like a hyperlink.

Thank you,
Marc
Jim Bennett (87) [Avatar] Offline
#2
The answers are yes, yes and yes!

An activity is the top level, and you can use fragments everywhere if you want to. As you mentioned it's not something I've gone into in too much detail as it could be a book in its own right.

Navigation drawers use fragments for everything, so when you click on a navigation item the fragment inside the main part of the view is changed.

You can read more on the Android presenter - the MvvmCross 'magic' that handles view navigation in Android apps, and see some samples at:

https://www.mvvmcross.com/documentation/presenters/android-view-presenter

If you follow the link to the samples there is a playground.droid project that has a sample for navigation using the drawer layout.
Marc (34) [Avatar] Offline
#3
Menus and Navigation
Hi,
The more I learn, the less I know.
After a few hours 'Googling' I've added a new term to my vocabulary: back stack.
Will Manning let you add a 'teaser' chapter? A preview of Volume 2? I'll buy the MEAP right now. smilie

IMO, the Countr example, with two master/detail screens, is a great introduction: simple enough to explain, complicated enough to be meaningful in the real world.
Because navigation is SO important to GUI's, a few chapters on the human engineering and the programming behind it will be a great next step in your exposition.
Topics like:
- resource consumption
- the back stack
- complex apps with 5-6-7 (or more) screens
- user-driven navigation among the screens
- menus
- everything I don't even know to ask about

Thx,
M.