How do I get the total page count?

QuakeulfQuakeulf NOMember ✭✭✭

Hi,
I am looking to get the total page count of the pages used in the setup part of an app. Unfortunately I cannot use anything but Modal-pages to keep the user on one page before being able to proceed to the next one because the setup needs to be done correctly.

I have looked around and I cannot seem to find a way to find the total amount of pages that this setup will go through. Is there a way to do this?

Thank you very much in advance for helping out.

Best Answer

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    What is the "setup part of the app"??

  • QuakeulfQuakeulf NOMember ✭✭✭

    @AlessandroCaliaro said:
    What is the "setup part of the app"??

    The app has two stages, the first stage is like in most apps where you setup the user details and add the devices needed to communicate with the services, the other part is for when the setup is completed and the user is using the devices and services that have been set up.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Are you using a Navigation? In NavigationStack there should be a Count...

  • QuakeulfQuakeulf NOMember ✭✭✭

    I am using ModalPages for navigation.

    Will the Count show the total pages I can go through?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    Application.Current.MainPage.Navigation.ModalStack.Count
    

    But I don't know if you can have more than 1 ModalPage in you stack

  • QuakeulfQuakeulf NOMember ✭✭✭

    @AlessandroCaliaro said:
    Application.Current.MainPage.Navigation.ModalStack.Count

    But I don't know if you can have more than 1 ModalPage in you stack

    Neither do I. I am still new to Xamarin.

    I am thinking I will have to manually count all the pages I will have to go through then increment an int per page (but this might get difficult when the setup branches and it has to do different operations on iOS and 'Roid).

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Use a "Normal" navigation, not Modal?

  • QuakeulfQuakeulf NOMember ✭✭✭

    Xamarin documentation recommends modal for setup processes (meaning "containing a user within a page until a task is completed"):

    https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/navigation/modal/

  • QuakeulfQuakeulf NOMember ✭✭✭

    I've had so many other things to think about I have let this slide for now.

  • JohnHardmanJohnHardman GBUniversity mod
    edited March 2017

    @Quakeulf - What Xamarin say is "A modal page encourages users to complete a self-contained task that cannot be navigated away from until the task is completed or cancelled". Even if Xamarin documentation were considered the gold standard re. user interface design, I still would not interpret that as all setup pages must be modal. As it is, there are many ways of designing setup pages - work out how your users would want to navigate around your app and use that (rather than one line in Xamarin documentation) to guide you regarding whether pages are modal or not

    Could you clarify why you want the number of setup pages, and whether it is the total number that will be displayed, or the number currently on the stack, that you are after.

  • QuakeulfQuakeulf NOMember ✭✭✭

    It's to give the user a clear way of showing how far through the setup they have proceeded.

    The total number might not be directly displayed but counted for and used in a bar or percentage meter measure.

  • QuakeulfQuakeulf NOMember ✭✭✭

    Ok, thank you for your help.

  • shubham1shubham1 Member ✭✭✭

    @JohnHardman said:
    @Quakeulf - Ok. For the total number, you will have to work that out, rather than rely on the size of the navigation stack. For most apps, the number of setup pages is fixed, so could be hard-coded. If you have a variable number (e.g. if some are only shown based on settings on the previous pages), then you will need to have a count that you can add to or subtract from, based on the previous settings.

    For the count of how far through the user is, you could derive it from the size of the navigation stack, but I wouldn't. It would be easier to maintain an index that you increment or decrement as the user goes forwards or backwards through the pages.

    Hi @JohnHardman, I want to do the same in my app. increment or decrement as the user goes forwards or backwards through the pages I want to implement this but how? Any Example/Sample?

Sign In or Register to comment.