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?
You should post some code...
BTW I think you have use navigation... something like
MainPage = new NavigationPage(new LoginPage());
after "login", you do something like
You should not have LoginPage in your NavigationStack, so
MainPage = new LoginPage();
after "login", pass login data to your first page (that is the "root" of your NavigationStack)
MainPage = new NavigationPage(new myFirstPage( myLoginData));
@AlessandroCaliaro Thanks for your quick reply
@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
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:
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies