Successfully reported this slideshow.
Your SlideShare is downloading. ×

Xamarin Navigation Patterns

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 53 Ad

Xamarin Navigation Patterns

Download to read offline

Dan Hermes, author of Xamarin Mobile Application Development, talks about how to give your users what they need to get around your Xamarin app quickly, moving from screen to screen with confidence and ease. Menus, tappable icons, buttons, tabs, and lists all offer ways to navigate your app. Dan will discuss industry-standard approaches for tying an app’s screens together in elegant and usable ways called navigation design patterns, based upon the concepts in his new book. Here are the most common mobile UI navigation patterns used in Xamarin development:

• Hierarchical
• Modal
• Drill-down list
• Navigation drawer
• Tabs
• Springboard
• Carousel

Learn how to use these navigation patterns in Xamarin.Forms and how to approach them in Xamarin.Android and Xamarin.iOS. Moving between screens also requires passing data between them. Dan will talk about different ways to maintain state during navigation.

You will learn about how to:

• Create navigation to get your user from screen-to-screen
• Create many kinds of menus
• Manage state and passing data between pages
• Combine navigation patterns to form a complete app

Dan Hermes, author of Xamarin Mobile Application Development, talks about how to give your users what they need to get around your Xamarin app quickly, moving from screen to screen with confidence and ease. Menus, tappable icons, buttons, tabs, and lists all offer ways to navigate your app. Dan will discuss industry-standard approaches for tying an app’s screens together in elegant and usable ways called navigation design patterns, based upon the concepts in his new book. Here are the most common mobile UI navigation patterns used in Xamarin development:

• Hierarchical
• Modal
• Drill-down list
• Navigation drawer
• Tabs
• Springboard
• Carousel

Learn how to use these navigation patterns in Xamarin.Forms and how to approach them in Xamarin.Android and Xamarin.iOS. Moving between screens also requires passing data between them. Dan will talk about different ways to maintain state during navigation.

You will learn about how to:

• Create navigation to get your user from screen-to-screen
• Create many kinds of menus
• Manage state and passing data between pages
• Combine navigation patterns to form a complete app

Advertisement
Advertisement

More Related Content

Similar to Xamarin Navigation Patterns (20)

Advertisement

Recently uploaded (20)

Xamarin Navigation Patterns

  1. 1. Xamarin Navigation Patterns Dan Hermes developer, author, consultant, founder of Lexicon Systems dan@lexiconsystemsinc.com www.mobilecsharpcafe.com @danhermes
  2. 2. About me • Software consultant since 1999 • Code, write, and lead teams • Minecraft, tiki cocktails, my parrot, and digital art • I love Xamarin
  3. 3. Xamarin Book Now Available on Amazon “This weighty book gives clear guidance that will help you build quality apps, starting with architectural considerations, and then jumping into practical code strategies.” - Bryan Costanich, Vice President, Xamarin “Dan Hermes’ extraordinary book is the most intelligent work on cross-platform mobile development I’ve seen.” – Jesse Liberty, Director of New Technology Development, Falafel Software, Xamarin Certified Developer / Xamarin MVP
  4. 4. • Founded in 1999 • Develop web and mobile apps • Microsoft technology stack We build apps for business
  5. 5. Our Clients Include
  6. 6. What is Navigation? • More than menus • Nav controls are a means to an end
  7. 7. What is Navigation? Gets our user from place to place
  8. 8. What is Navigation? Provides the UI skeleton of our entire app
  9. 9. What is Navigation? • Gives users what they need to get around an app quickly, moving from screen to screen with confidence and ease • This may include menus, tappable icons, buttons, tabs, and list items, as well as many types of gesture-sensitive screens to display data, information, and options to the user
  10. 10. Navigation Patterns •Hierarchical •Modal •Drill-down list •Navigation drawer •Tabs •Springboard •Carousel
  11. 11. Hierarchical Modal
  12. 12. Drill-down List
  13. 13. Navigation Drawer
  14. 14. Tabs
  15. 15. Springboard
  16. 16. Carousel
  17. 17. Xamarin.Forms Navigation Navigation Pattern Xamarin.Forms Class Hierarchical NavigationPage Modal NavigationPage, alerts, and ActionSheets Drill-down lists NavigationPage, ListView, and TableView Navigation drawer MasterDetailPage Tabs TabbedPage Springboard images with gesture recognizers Carousel CarouselPage
  18. 18. Most Common Navigation Patterns • Hierarchical • Modal
  19. 19. Hierarchical • stack-based pattern • allows users to move down into a stack of screens • pop back out again, one screen at a time • drill-down or breadcrumb
  20. 20. Hierarchical: Up and Back Buttons Up Back Up
  21. 21. Hierarchical Navigation using NavigationPage • Instantiate a NavigationPage and pass in a ContentPage • In the child page: • Set Title and Icon Properties • Navigation.PushAsync (new MyPage) • Navigation.PopAsync();
  22. 22. NavigationPage public class App : Application { { public App() { MainPage = new NavigationPage(new HomePage()); } }
  23. 23. NavigationPage • Demo: HomePage
  24. 24. NavigationPage: Remove and Insert • Navigation.RemovePage(page); • Navigation.InsertPageBefore(insertPage, beforePage);
  25. 25. Back Button public override void OnBackButtonPressed() { // your code here base.OnBackButtonPressed (); }
  26. 26. Modal
  27. 27. Modal Types 1. Box: floats on top of the main page and is usually an alert, dialog box, or menu that the user can respond to or cancel 2. Screen: replaces the main page entirely, interrupting the hierarchical navigation stack
  28. 28. Modals in Xamarin.Forms • NavigationPage for full-page modals • Alerts for user notifications • Action sheets for pop-up menus
  29. 29. Full Screen Modal using Push and Pop • Navigation.PushModalAsync( new nextPage()); • Navigation.PopModalAsync();
  30. 30. Full Screen Modal using Push and Pop • Demo: ModalPage
  31. 31. Modal: Alerts Boolean answer = await DisplayAlert(" Start", "Are you ready to begin?", "Yes", "No");
  32. 32. Modal: Action Sheets Button button = new Button { Text = "Show ActionSheet" }; button.Clicked += async (sender, e) => { String action = await DisplayActionSheet("Options", "Cancel", null, "Here", "There", "Everywhere"); label.Text = "Action is :" + action; };
  33. 33. Modal: Action Sheets
  34. 34. Modal: Action Sheets • Demo: PopupMenu
  35. 35. State Management • Maintain the illusion of continuity during navigation • Sharing of data between screens • Pass variables directly into an instantiated ContentPage
  36. 36. Passing Data • Pass data values directly into a page’s constructor • Static Properties dictionary on the Application object to persist key/ value pairs to disk • Static data instance (global) available to all pages • Static properties on the Application object
  37. 37. Passing Data • Demo: PropertiesPage1 • Demo:GlobalPage1, Global
  38. 38. Drill-down Lists • by Item • by Page • Grouped
  39. 39. Drill-down Lists • by Item – use a ListView • by Page – use a ListView • Grouped – use a TableView Use PushAsync when user clicks a row
  40. 40. Drill-down Lists: NavigationPage • Wrap list page in a NavigationPage public class App : Application { public App() { MainPage = new NavigationPage(new DrilldownListViewByItem ()); } }
  41. 41. Drill-down Lists • Demo: DrilldownListViewByItem • Demo: DrilldownListViewByPage • Demo: DrilldownTableView
  42. 42. Navigation Drawer • Demo: MasterDetailPage
  43. 43. Tabs using TabbedPage • Static • Data-bound • Demos
  44. 44. Springboard: Images with Gesture Recognizers • Roll your own Springboard (demo)
  45. 45. Carousel using CarouselPage this.Children.Add(new FirstPage()); this.Children.Add(new SecondPage()); this.Children.Add(new ThirdPage()); demo
  46. 46. Xamarin.Android Navigation • Hierarchical navigation using Toolbar or ActionBar • Modal using DialogFragment, AlertDialog, and PopupMenu • Drill-down list using ListView • Navigation drawer using DrawerLayout • Tabs using ActionBar
  47. 47. Xamarin.iOS Navigation • Hierarchical navigation using UINavigationController, the push segue, or the PushViewController • Modal using the modal segue, the PresentViewController, and UIAlertAcontroller • Drill-down list using UINavigationController • Navigation drawer using components • Tabs using UITabBarController
  48. 48. Android State Management Android uses a class called Bundle, which is a dictionary that contains passed values, housed inside a class called Intent, which we use to call new activities
  49. 49. iOS State Management iOS developers favor public properties on the destination view controller, but iOS supports passing parameters into the destination page’s constructor
  50. 50. Xamarin.Forms Navigation Navigation Pattern Xamarin.Forms Class Hierarchical NavigationPage Modal NavigationPage, alerts, and ActionSheets Drill-down lists NavigationPage, ListView, and TableView Navigation drawer MasterDetailPage Tabs TabbedPage Springboard images with gesture recognizers Carousel CarouselPage
  51. 51. It’s all on GitHub https://github.com/danhermes/xamarin-book-examples
  52. 52. Need Something Xamarin-flavored? • I do Xamarin consultations • I do Xamarin training • My firm does Xamarin development • We help make Xamarin projects work
  53. 53. Xamarin Navigation Patterns Dan Hermes developer, author, consultant, founder of Lexicon Systems dan@lexiconsystemsinc.com Available on Amazon My blog: www.mobilecsharpcafe.com Twitter: @danhermes

Editor's Notes

  • Why all the funny names? CROSS PLATFORM terms
    Inspired in part by by Adam Kemp’s blog post, Navigation in Xamarin.Forms
    and Mobile Design Pattern Gallery by Theresa Neil
    @TheRealAdamKemp
  • Why all the funny names? CROSS PLATFORM terms
    Inspired in part by by Adam Kemp’s blog post, Navigation in Xamarin.Forms
    and Mobile Design Pattern Gallery by Theresa Neil
    @TheRealAdamKemp
  • Why all the funny names? CROSS PLATFORM terms
    Inspired in part by by Adam Kemp’s blog post, Navigation in Xamarin.Forms
    and Mobile Design Pattern Gallery by Theresa Neil
    @TheRealAdamKemp
  • Carousel – we’ll get to it. – Doesn’t show well in a static image
  • images
  • Drill-down (push onto stack), pop back up
  • images
  • Dropdown menu - ToolBarItems
  • Single, interruptive pop-up or screen
    can usually be dismissed with a Cancel button
  • Both the global and Application object techniques use the singleton pattern, and are useful for app-wide classes such as data access or business objects.
  • Activity and fragment properties are available but not recommended (rotation, low mem, etc.)

×