I want to transfer data from login screen to next screen in xamarin.forms

I have created a login screen and I want to transfer the login user details to the next screen how can I do that?

My next activity is showing back how should I hide the black navigation arrow?

Best Answer

Answers

  • kalkotekedarkalkotekedar USMember ✭✭

    @AlessandroCaliaro Thanks for your quick reply

  • JohnHardmanJohnHardman GBUniversity ✭✭✭✭✭
    edited September 14

    @kalkotekedar - Regarding how to get rid of the back button in this scenario. I assume that displaying the login page is the first thing you do, and that your login page is a navigation page? If so, after successful logon, create the next page but rather than pushing it on to the navigation stack, insert it into the navigation stack before the logon page, then pop the current page.

    There are other ways of handling login pages and navigation, but the above is the scenario most people ask about.

    In terms of transferring the user details from the login page, you can do this in multiple ways also. Either store the details in a view model (recommended), in static variables, in persisted settings, or simply pass as parameters to the next page's constructor etc

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Let's start with some foundation concepts:
    "Screens" should never hold data. ViewModels hold data. UI (Your screens) should be binded to the ViewModels. UI is only a way to interact with data.
    If you want to have two screen see the same data, you only need to reference the same ViewModel, generally by setting it as the BindingContext
    If you want to get a quick overview and build up a starter app to get your feet wet on these concepts:
    http://www.RedPillXamarin.com

Sign In or Register to comment.