windows phone navigation immediately after loading page

♀尐吖头ヾ 提交于 2019-12-01 14:28:26

You can do as Rana Tallal said.

Or you can write it in code:

public MainPage()
{
    InitializeComponent();

    Loaded += (s, e) =>
    {
        InitializeSettings();

        // Some login-password check condition
        if (_login && _password)
            NavigationService.Navigate(new Uri("/Conversation.xaml",
                                               UriKind.Relative));
    }
}

Well create a new function... and in that perform the checks at which you want it to be navigated and if the checks are ok right in it than call the navigation service navigationservice.navigate(....) code. Now you need to tell the program to call this function when the mainpage is completely loaded. To do so in the xml of mainpage inside tags at the end of it write loaded="function_name" Now when ever the page will be loaded this function will be called. If the login information is present in the isolated storage than the navigation sevices will be called otherwise the mainpage will be shown.

Make sure to put (object sender, RoutedEventArgs e) in the functions parameters(as it is a event handler).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!