I created a new blank Xamarin PCL app in Visual Studio 2015. It runs on all the platforms. I then add a XAML page named GuyBarSceneTabs to my PCL and change my app.cs file in my PCL so the App() code only contains
MainPage = new GuyBarSceneTabs();
This all works and I can run the projects again and it shows my XAML page. Next I add another XAML page name NearbyLocations
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="GuyBarScene.NearbyLocations"
Title= "Nearby Locations">
</ContentPage>
I also then change the GuyBarSceneTabs page to be a tabbed page as follows and also change the code behind page to inherit from TabbedPage:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:GuyBarScene;assembly=GuyBarScene"
x:Class="GuyBarScene.GuyBarSceneTabs">
<TabbedPage.Children>
<local:NearbyLocations />
</TabbedPage.Children>
</TabbedPage>
</TabbedPage.Children>
public partial class GuyBarSceneTabs : TabbedPage
{
public GuyBarSceneTabs()
{
InitializeComponent();
}
}
Now when I try to run the app I get the error message: "The given key was not present in the dictionary. There error is generated in the following code which is called from the InitializeComponent method of GuyBarSceneTabs page:
public partial class GuyBarSceneTabs : global::Xamarin.Forms.TabbedPage {
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Forms.Build.Tasks.XamlG", "0.0.0.0")]
private void InitializeComponent() {
this.LoadFromXaml(typeof(GuyBarSceneTabs));
}
}
Any suggestions as to what I am doing wrong? Do I need to change my App() code in some manner?