-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
t/bugSomething isn't workingSomething isn't working
Description
Description
When adding Views into GlobalXmlns.cs like this:
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "Faluf.CodexUI.MAUI.Views")]
It doesn't allow, in my AppShell.xaml, to remove the prefix views: for choosing the page. For example:
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Faluf.CodexUI.MAUI.AppShell">
<ShellContent Title="Home" ContentTemplate="{DataTemplate MainPage}" Route="MainPage" />
</Shell>
I'm getting:
Microsoft.Maui.Controls.Xaml.XamlParseException: 'Position 7:32. DataTemplateExtension: Could not locate type for MainPage.'
My MainPage is located under
Faluf.CodexUI.MAUI/Views/MainPage.xaml + MainPage.xaml.cs (The namespace is set to Faluf.CodexUI.MAUI.Views)
I also set csproj values for PropertyGroup:
<DefineConstants>$(DefineConstants);MauiAllowImplicitXmlnsDeclaration</DefineConstants>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
Steps to Reproduce
- Create a new .NET MAUI app
- Create a folder Views/
- Move MainPage to the new folder, and change namespace accordingly
- Open GlobalXmlns.cs and add
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "<YourNamespace>.Views")] - Open AppShell.xaml and remove prefix colon on the MainPage.
Link to public reproduction project repository
No response
Version with bug
10.0.0-rc.1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
net10.0-windows10.0.19041.0
Did you find any workaround?
To use prefix - XmlnsPrefixAttribute works too in the GlobalXmlns.cs, but DataTemplate still needs the prefix.
Relevant log output
Metadata
Metadata
Assignees
Labels
t/bugSomething isn't workingSomething isn't working