1

I'm starting a WPF project which will use Modern-UI as the theme. I'm trying to create a ModernTab which will link to another page, but I'm getting the following error:

Page can have only Window or Frame as parent

My Page is stored in a folder named "Pages" and I appear to be referencing the Page in the same manner as other developers' working code. Where am I going wrong?

<Page x:Class="LayoutTab"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:WpfApplication1"
      xmlns:mui="http://firstfloorsoftware.com/ModernUI"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
      Title="LayoutBasic">
    <Grid Style="{StaticResource ContentRoot}">
        <mui:ModernTab SelectedSource="Pages/LayoutBasic.xaml" Layout="Tab">
            <mui:ModernTab.Links>
                <mui:Link DisplayName="My Tab" Source="Pages/LayoutBasic.xaml"/>                
            </mui:ModernTab.Links>
        </mui:ModernTab>
    </Grid>
</Page>
Jiminy Cricket
  • 1,377
  • 2
  • 15
  • 24

1 Answers1

1

I suppose your LayoutBasic.xaml derives from Page, doesn´t it? In that case the error message contains all you need to know: A page can only be stored as the direct content of a Frame or a Window.

To fix that problem the easy way: Replace the Page references within LayoutBasic.xaml and LayoutBasic.xaml.cs with UserControl.

christoph
  • 1,019
  • 1
  • 12
  • 23