I can not navigate to the next page in windows phone 7

Posted by Vijay on Stack Overflow See other posts from Stack Overflow or by Vijay
Published on 2014-08-19T04:16:49Z Indexed on 2014/08/19 4:20 UTC
Read the original article Hit count: 148

Filed under:
|
|

I am trying to navigate form one page to another page depends upon the login.

If already user logged in, Welcome page should open. Else Log in Page should open.

I am trying like this. The Splash Page is the start up page.

This is a Splash Screen Xaml.cs:

namespace NewExample.Views
{
    public partial class SplashPage : PhoneApplicationPage
    {
        public SplashPage()
        {
            InitializeComponent();
            this.DataContext = new SplashPageViewModel();
        }
    }
}

This is Splash Screen View Model: Here I am check the user already logged in or not.

namespace NewExample.ViewModel
{
    public class SplashPageViewModel
    {
        public static bool isLogin = false;

        public SplashPageViewModel()
        {
            var rootFrame = (App.Current as App).RootFrame;
            if (isLogin)
                rootFrame.Navigate(new Uri("/Views/WelcomePage.xaml", UriKind.Relative));
            else
                rootFrame.Navigate(new Uri("/Views/LoginPage.xaml", UriKind.Relative));
        }
    }
}

But it is not working. The Splash Page only showing. This is not navigating to another page. Please help me to resolve this problem.

© Stack Overflow or respective owner

Related posts about c#

Related posts about windows-phone-7