Search code examples
mauimaui-windows.net-maui.shell

.Net Maui - ShellContent navigation issue


I am trying to navigate to page "TestView" which is in folder "Views" of my VisualStudio solution. Here the compile Error.

Error XFC0000 Cannot resolve type ":TestView"

AppShell.xaml file

<FlyoutItem Title="test" FlyoutIcon="List">

        <ShellContent
        Title="Test Page"
        ContentTemplate="{DataTemplate local:TestView}"
        Route="TestView" />
    </FlyoutItem>

Need Help to solve the Compile Error

Here the link to my GitHub project MPC-Calculator Maui Branch

enter image description here


Solution

  • Change your namespace in your shell from:

    xmlns:local="clr-namespace:MPC_MassPropertiesCalculator_MAUIapp"
    

    To this:

    xmlns:local="clr-namespace:MPC_MassPropertiesCalculator_MAUIapp.Views"
    

    Basically if you wanna refer a View in your XAML you need to have its exact namespace and then the name of your View.