Silverlight windows phone 8.1 project: Unable to navigate to page 2 - c#

I have a weird issue. I am not sure what I am doing wrong. I am doing a Windows Phone 8.1 Silverlight app project that (for now) has two pages. Page1.xaml has a Welcome page with a button, that, when clicked takes you to a second page with two textblocks one LongListSelector and one textbox,that accepts only numbers (InputScope="Number"). The LongListSelector is for selecting countries and it has it's own logic of the alphakeygroups and everything else (JumpList, GroupHeader, ItemTemplate). For the click event of the button in page1, this is what I've put in
NavigationService.Navigate(new Uri("/Page2.xaml", UriKind.Relative));
This is supposed to take me to the page two but it doesn't. Here're the errors I get:
after I click Continue twice (the Emulator button changes to Continue), I get this:
I tried with a dummy page, Page3_test.xaml, and that works fine. When I click the button on page1, it takes me to page3.
What am I doing wrong?
VS2013 - U4; W8.1;

Related

How can I open page in my Xamarin app without using navigation?

I have a Xamarin Forms application, which has 2 buttons on the toolbar. Currently I'm using FreshMVVM (and it's navigation). I want to load pages without putting them into the navigation. I do not want to have the 'back' button on the toolbar, also I do not want the user return the last page.
Here's how I push a page currently:
CoreMethods.PushPageModel<FirstChoicePageModel>();
I tried to push as a modal, but that way the toolbar buttons does not work until I press back. Should I make new navigation containers and switch to them if I push the buttons?
It's been a little while since I've used FreshMVVM, but if I recall correctly, you have 2 options:
If you want to completly reset the nav stack, you can do CoreMethods.PushPageModelWithNewNavigation<FirstChoicePageModel>();
If you want to keep the nav stack, you can set NavigationPage.SetHasBackButton(this, false); in the code behind of the view.
For both of these options, it may necessary to intercept the back button on Android. In the code behind there is an overrideable method:
protected override bool OnBackButtonPressed()
{
return true; // prevent Xamarin.Forms from processing back button
}
If you want to show a page, but you doesn't want to navigate (change the current page), you can always use Popups.
See this link https://github.com/rotorgames/Rg.Plugins.Popup

Arrow Keys with Pivot Page in app with a Navigation Menu don't initially work

I know you want to see code, but the easiest way to show this problem is to create a new project after installing the new Windows Template Studio Extension. Note: if you create a project with a Navigation menu another way, the problem still exists.
I created a new Windows Template Studio Project named "Test".
For "Project Type": choose Navigation Pane (default).
For "Framework": choose Code Behind (default).
After clicking "Next"
For "Pages (9) - Add Multiple" : choose Tabbed, keep default name "Tabbed".
Click the "Create" button.
Run the project and navigate to the "Tabbed" page.
Use the Right and Left Arrow keys: nothing happens (Item 1 doesn't change to Item 2).
If you click on a PivotItem Header, or on the blank page first the arrow keys will then work.
Note if you use the "Tab" key it will select and underline the first PivotItem Header and the arrow keys will also work.
The Microsoft News app is an example of a Pivot page and Navigation menu working correctly.
This is most likely because when you first navigate to the Tabbed page, the Pivot control is not on focus. So you can try setting it whenever it's first loaded.
public MainPage()
{
InitializeComponent();
MyPivot.Loaded += (s, e) => MyPivot.Focus(FocusState.Programmatic);
}

Xamarin Forms masterdetail hide backbutton

I am working on Xamarin forms shared project with a master detail page. When I run the app the master detail page is the first item that loads yet it shows the back button which once clicked opens the navigation (master) drawer. This makes no navigation sense whatsoever! I have tried to hide the back button but have not been able to do this. Has anyone come across this and succeeded in doing this? I would prefer a programmatical solution rather than a xaml one.
I have tried adding the below code:
NavigationPage.SetHasBackButton(this, false);
But this doesn't work. I want to keep the toolbar as I will be adding my own menu items here but want the back button gone.
Try this:
NavigationPage.SetBackButtonTitle(this, string.Empty);
NavigationPage.SetHasBackButton(this, false);

How to resolve back button issue in windows phone 8 game application?

This question may be possible duplicate of
WP8 back button go two steps back
My game page structure as follow
MainPage(Select New Game) - > Level1 Page(After complete 60 sec this page automatically goto next page->Alert page (it contain TryAgain-Home-Exit Buttons if user click TryAgain Button "Level1" Page Show)
My problem start here..
Now User in "Level1" user click phone back button it show the Alert Page . it's wrong
but correct way is from "Level1" to MainPage
I try following code in Level1 Page
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
RootFrame.RemoveBackEntry();
base.OnBackKeyPress(e);
}
I got error in RootFrame The name 'RootFrame' does not exist in the current context
Any one tell me where i made mistake and what code i need to add for RootFrame. this is my first Wp8 game app development. Thank You
I just had this same problem. The tutorial uses RootFrame.RemoveBackEntry();
The default is NavigationService.RemoveBackEntry();

Want to create a UIContoller in a UITabController but with no tab button

I want to display an intro view (tutorial) on my monotouch app that when the user clicks on a button will take them to the main storyboard, which contains a UITabController.
I'm new to monotouch and can't work out how to do this. I'm adding an extra view that's been created to the tab bar controller in the AppDelegate.FinishedLaunching, but this always adds the button to the tab bar.
When the user has clicked the button once I don't want to show the intro page ever again, it's a one time deal (I'll save some value to disk to work this out), so I don't want to just add it to the tab controller.
Incidentally if anyone can show me where monotouch decides that it's going to start with the storyboard please let me know. The only thing I've found is the little start arrow that you drag around in XCode, but what if I have two storyboards and I want to load one based on the user being logged in or something.
You need to create simple entry ViewController with the button (Controller1). The next controller in storyboard will be the tabcontroller (TabController).
Thus you will always has the first entry screen in your application.
If you don't want to show it later than make transition from Controller1 to TabController before it is loaded. For example, override the ViewWillAppear method.
The second approach. Use this code to launch whatever you want view above all your controllers at any time:
UIViewController root= UIApplication.SharedApplication.KeyWindow.RootViewController
UIView myCustomView=new MyCustomView();
root.Add(myCustomView);
//call myCustomView.RemoveFromSuperview() and it will be dismissed

Categories