Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type 'page' does not support direct content

Tags:

uno-platform

I create new Uno Cross-Platform App 2.2 from template. When I open Shared->MainPage.xaml in doesn't open designer in code view there is a underlined error The type 'page' does not support direct content

<Page
    x:Class="App6.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App6"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <TextBlock Text="Hello, world!" Margin="20" FontSize="30" />
    </Grid>
</Page>
like image 586
Matevz Avatar asked May 05 '20 18:05

Matevz


2 Answers

This is an Intellisense issue which happens when the project selector (the DropDown at the top of the XAML editor) is not on the UWP project, but rather on iOS, Android or another platform.

If you select the UWP project, close the editor, and re-open it again, the errors will disappear.

As of Visual Studio 2019 16.5 the issue is still present, but is likely to be addressed in a future version.

like image 94
Jérôme Laban Avatar answered Nov 13 '22 20:11

Jérôme Laban


At the beginning I can use designer to edit MainPage.xaml in Shared folder, after one moment (there was an error that crashed my VS) not any more...

So solution is to move MainPage.xml to UWP project, edit there, and than move it back. That's work for now.

Maybe it would work with linked file.

like image 23
Matevz Avatar answered Nov 13 '22 21:11

Matevz