Describe the bug
When saving a .Net Maui xaml file the error " 'x' is an undeclared prefix " appears. This is when using implicit namespaces.
To Reproduce
-
Create a .Net Maui project
-
Add this to the project file:
<PropertyGroup> <!-- First, enable preview feature flag --> <EnablePreviewFeatures>true</EnablePreviewFeatures> <!-- Then, opt-in for the implicit namespace feature --> <DefineConstants>$(DefineConstants);MauiAllowImplicitXmlnsDeclaration</DefineConstants> </PropertyGroup>
-
Create a client page/view.
-
Remove:
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-
According to the documentation these should not be necessary.
See: https://devblogs.microsoft.com/dotnet/simpler-xaml-in-dotnet-maui-10/
-
Save, and the error message appears.
-
What's more, the code compiles and runs perfectly without these two lines.
Expected behavior
The file will save, accepting the missing "x:..." declaration, preferably understanding that "MauiAllowImplicitXmlnsDeclaration" is being used. Or have an option in the XamlStyler to ignore these.
Screenshots
Version Info (please complete the following information):
- Windows 11
- Visual Studio: 2026
- XAML Styler: version 3.2501.8
- .Net 10
Describe the bug
When saving a .Net Maui xaml file the error " 'x' is an undeclared prefix " appears. This is when using implicit namespaces.
To Reproduce
Create a .Net Maui project
Add this to the project file:
<PropertyGroup> <!-- First, enable preview feature flag --> <EnablePreviewFeatures>true</EnablePreviewFeatures> <!-- Then, opt-in for the implicit namespace feature --> <DefineConstants>$(DefineConstants);MauiAllowImplicitXmlnsDeclaration</DefineConstants> </PropertyGroup>Create a client page/view.
Remove:
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"According to the documentation these should not be necessary.
See: https://devblogs.microsoft.com/dotnet/simpler-xaml-in-dotnet-maui-10/
Save, and the error message appears.
What's more, the code compiles and runs perfectly without these two lines.
Expected behavior
The file will save, accepting the missing "x:..." declaration, preferably understanding that "MauiAllowImplicitXmlnsDeclaration" is being used. Or have an option in the XamlStyler to ignore these.
Screenshots
Version Info (please complete the following information):