Navigate back to MainPage Visual Studio 2013 - c#

I have a windows phone app that navigates between pages and I use
NavigationService.GoBack();
to go back to the Mainpage. All good and works great.
The app is a simple 2 page app and works great under IOS, Android and Windows Phone, but I need to find the correct way to go back to the MainPage in Windows Store Apps using VS2013EX.
I tried
Frame.GoBack();
but it does not work well due to the fact that my second page is a WebView and if I navigate to another page on the webview, the Frame.GoBack() does not remove the second page but just goes back to the other web page. Its almost like Frame.GoBack() is just the webView's go back method.
I tried this code:
this.Frame.Navigate(typeof(MainPage));
This does bring me back to the MainPage, but I don't think its correct as should I not be removing the current page from the Stack????

Try this: add an event handler for OnNavigatedFrom in which do the (WebviewName).NavigateToString("") and use this.Frame.GoBack().

Related

Why doesn't GoBackAsync() fire on OnNavigatedTo() method of previous page?

I have two pages pageA and pageB.
When I navigate from pageA to pageB and later execute _navigationService.GoBackAsync(), it works correctly and it navigates me to pageA.
But, OnNavigatedTo() and OnNavigatingTo() in pageA doesn't seem to execute (that I can tell?). PageA is a tabbedPage and I'm using Xamarin forms and Prism 7.
I'm testing it on iPhone.
What could I be doing incorrectly?
That (what you have) should work. You have found a bug.
Please submit your issue to the Prism GitHub site and provide as much information as possible as well as a sample app that reproduces the issue.

Navigate to another page and then resume app

I'm developing a UWP app for both mobile and PCs.
I need to ask for a passcode every time the app start, also when resumed after suspension.
When the app is resumed I navigate to a pin check page, then, if the passcode is correct I navigate to the page which was shown before suspending.
The problem is that I have a page with a textbox and other control, how can I resume the text in TextBox?
When I resume the app without using pin page, I have no problem because the content of the page is totally resumed.
Thanks
The problem is that I have a page with a textbox and other control, how can I resume the text in TextBox?
You can use UIElement.CacheMode property and Frame.CacheSize property to cache the content of the page. You can refer to my another case UWP page state manage.
Or if you're using some templates for example template 10 to develop your app, you can use its own cache method, you can refer to Docs | Navigation Cache.

Universal Windows 8.1 App Page Change

I am trying to change pages when a text block is selected but I don't know how to get my app to go to the next page.
Figured out the answer to my question. In order to navigate between pages, you need to make the following call when the event you want the transition to happens:
this.Frame.Navigate(typeof(/*name of page you want to transition to*/));

How to change start page in Windows 8.1 store app C#

I am building an app using a split page. I have tried without success to have it start at the split page not the main page or the items page when using the split app template. I have changed the code in the app.cs and the package manifest and nothing works. This is the code I changed in app.cs.
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if(rootFrame.Navigate(typeof(ItemsPage), e.Arguments));
}
I changed this to SplitPage and it just fails.
I have experimented and I can add a blank page and make it open with that. I am sure it has something to do with the navigation code but surely there is some kind of simple override so people can personalize their apps. I really get tired of having to write everything from scratch because I have to read 5 different pages of code behind and try to figure out how they're interacting and it's actually easier to write yourself than use the templates or pages when it should be the opposite. JMO.
I've done a lot of searching but everything I've found is written for VS 2012 and Windows 8.
Thanks for any advice.

How to display EULA in WP7 application?

As stated by Microsoft, it's not possible to programatically navigate from the main page. I have a EULA page that I need to show if the user is using the app for the first time. My plan was to determine on the main page if the app has been used before. If not, I had planned to navigate to the EULA page, but this is not possible. How can I get around this navigation limitation?
The issue with a dedicated EULA page that is automatically pushed on the back stack is that the application won't quit when the user presses the Back key when in the EULA page.
You should instead use a Popup control that you show and hide when appropriate.
See Peter Torr's post on how to exit an application for more details and background.
It should be possible to navigate from the main page easily using:
if (!eulaAgreed)
NavigationService.Navigate(new Uri("/EULAPage.xaml", UriKind.Relative));
Probably best to put this code in OnNavigatedTo of your main page or even later in the page cycle using Dispatcher.BeginInvoke(...). Putting it before that (i.e. in the constructor or Loaded) may not work.
What do you think happens to the Navigation stack?
Would the users be able to access the EULA page again? maybe by clicking back from the MainPage ?

Categories