Я пытаюсь реализовать страницу оболочки, тем не менее при попытке компилирования я получаю следующую ошибку в MasterDetailShell.xaml. Я предполагаю, что что-то не так в строках независимо от пути.
ContentTemplate="{DataTemplate local:Page1}"
Ошибка:
Type Page1 not found in xmlns MobileAppXamarinForms
Это мой код:
App.cs:
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new MasterDetailShell();
}
}
MasterDetailShell.cs
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MasterDetailShell : Shell
{
public MasterDetailShell()
{
InitializeComponent();
}
}
MasterDetailShell.xaml
<?xml version="1.0" encoding="utf-8" ?>
<Shell 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"
mc:Ignorable="d"
x:Class="MobileAppXamarinForms.Views.MasterDetailShell.MasterDetailShell">
<FlyoutItem Title="MyTabbApp"
Shell.TabBarIsVisible="False"
FlyoutDisplayOptions="AsMultipleItems">
<ShellContent Title="Bears" Icon="" IsTabStop="True" ContentTemplate="{DataTemplate local:Page1}"></ShellContent>
<ShellContent Title="Bears" Icon="" IsTabStop="True" ContentTemplate="{DataTemplate local:Page2}"></ShellContent>
</FlyoutItem>
<ShellContent Title="About" Icon="" ContentTemplate="{DataTemplate local:Page1}"></ShellContent>
</Shell>
Расположение файлов:
![enter image description here](https://i.stack.imgur.com/4uFJz.png)