Keeano
Keeano

Reputation: 308

Removing the MainPage.xaml

I have been looking into this for awhile and have had no real luck.

My project consists of a Login page that happens to be the MainPage.xaml.

The users who will be using this App should not be able to go back to the page with the Windows mobile 7 back button.

My Second Page is Called afterLoginMenu.xaml, i want it so that when the user presses the back button from the second page it will close the application never showing the login page again.

Is this Possible? and if so How?

Thank you In advance!

Upvotes: 0

Views: 280

Answers (2)

Nghia Nguyen
Nghia Nguyen

Reputation: 2665

after create your Login popup control, do something like this:

        public MainPage()
    {
        InitializeComponent();
        if (someVariable == 0)
        {
            myPopup = new Popup() { IsOpen = true, Child = new Login() };


            someVariable = 1; //this will be a global value, so the popup wouldn't open again when back key is pressed
        }


    }

Upvotes: 0

William Melani
William Melani

Reputation: 4268

Unless you're using mango, you have two options: Display a Popup which has your login information (like the Facebook app) or have both the login and 'main page' on the same page, and change the Visibility of the page controls depending on whether or not the user needs to log in.

<Grid x:Name="LayoutRoot>
<Grid x:Name="LoginGrid" Visibility="Visible">
...</Grid>
<Grid x:Name="AuthenticatedGrid" Visibility="Collapsed">
...</Grid>
</Grid>

Upvotes: 4

Related Questions