I have a ContentControl where I want to load the page myPage2. My XAML Codefrom this page looks like this:
There is no reason to use a Page
within a ContentControl
. A Page
is a subclass of the UserControl
class that adds support for being used within a Frame
control to support navigation, back stack/history, etc. You should probably replace Page
with UserControl
in XAML and code behind, so you would end up with something like this:
...
...
You can put the UserControl
itself in a DataTemplate
if you want to use it as a DataTemplate
in a ContentControl
: