So, everything works perfectly and I can see the beautiful display of my code when all of a sudden one exception stops me from running my program. I'm surely doing something wrong, but I don't know where or what since I'm working with two content pages and one is working perfectly and the other content page is almost identical aside from showing more detailed information.
The error:
Error XFC0004 Missing default constructor for "AoFStructures.StructureDepth"`
My mainpage that allows navigation:
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AoFStructures"
mc:Ignorable="d"
x:Class="AoFStructures.MainPage">
<NavigationPage Title="Structures">
<x:Arguments>
<local:StructureOverview/>
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Structure info">
<x:Arguments>
<local:StructureDepth/>
</x:Arguments>
</NavigationPage>
</TabbedPage>
My scrutctureDepth.xaml.cs
namespace AoFStructures
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class StructureDepth : ContentPage
{
Structure _selectedStructure;
StructureInfo _structured = null;
public StructureInfo ChosenStructure
{
get { return _structured; }
set { _structured = value; OnPropertyChanged("MyStructureName"); }
}
public StructureDepth(Structure structure)
{
BindingContext = this;
InitializeComponent();
_selectedStructure = structure;
}
private void ContentPage_Appearing(object sender, EventArgs e)
{
}
}
}
Structuredepth.xaml
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AoFStructures"
Appearing="ContentPage_Appearing"
x:Class="AoFStructures.StructureDepth">
<ContentPage.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackLayout>
<Label Grid.Column="0" Text="Name:"/>
<Label Grid.Column="1" Text="{Binding ChosenStructure.Name}"/>
<Label Grid.Column="0" Text="Age:"/>
<Label Grid.Column="1" Text="{Binding ChosenStructure.Age}"/>
<Label Grid.Column="0" Text="Cost:"/>
<Label Grid.Column="1" Text="{Binding ChosenStructure.Cost}"/>
<Label Grid.Column="0" Text="Build time:"/>
<Label Grid.Column="1" Text="{Binding ChosenStructure.Build_item}"/>
</StackLayout>
</Grid>
</ContentPage.Content>
</ContentPage>