0

Having weird issues where the debugger says that I have and error (Cannot create an instance of "FramePage") but yet I can put a breakpoint inside of the constructor of the page type (its derived from the base class of Page) it successfully enters, which kidna makes the error look like a red herring.

I have tried looking through a similar question here at Stackoverflow and another but neither solutions worked for me

Though keep in mind, I have 0 experience writing my own page types and don't even know what to Google in attempt to research how to create them properly as I'm sure they have a proper name and set of tutorials.

Here is a the offending code:

SecondPage.Xaml.cs

/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SecondPage : FramePage
{
    public SecondPage()
    {

        InitializeComponent();
        FrameTitle = "Secondpage ViewModel is active";

    }    
}

SecondPage.Xaml

<local:FramePage
    x:Class="Kiwibank.MortgageCalculator.UI.Win8.SecondPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Kiwibank.MortgageCalculator.UI.Win8"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    DataContext="{Binding Second, Source={StaticResource Locator}}">

    <Grid Background="Red">

    </Grid>
</local:FramePage>

FramePage.cs

public class FramePage : Page
{
    public FramePage()
    {
        FrameTitle = "Default Title";
    }

    private string _frameTitle;
    public string FrameTitle
    {
        get
        {
            return _frameTitle;
        }
        set
        {
            _frameTitle = value;
            MasterPageAccessor.Header = _frameTitle;
        }
    }
}

Thanks

Community
  • 1
  • 1
Michael Crook
  • 1,520
  • 2
  • 14
  • 37

0 Answers0