CommunityToolkit / CommunityToolkit/Maui
[BUG] CommandBehavior not found when using global xmlns
- Dominant language
- C#
- Stars
- 2.7k
- Forks
- 500
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 7
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Did you read the "Reporting a bug" section on Contributing file?
- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
### Current Behavior
NOTE: THIS IS NOT A BUG, BUUT I DID NOT KNOW WHERE TO PUT IT
I made my global file like this
`//
// Tus namespaces
//
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "TaskManagerApp.Controls")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "TaskManagerApp.Models")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "TaskManagerApp.ViewModels")]
//
// CommunityToolkit.Maui (TODOS los namespaces necesarios)
//
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "CommunityToolkit.Maui")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "CommunityToolkit.Maui.Behaviors")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "CommunityToolkit.Maui.Extensions")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "CommunityToolkit.Maui.Core")]`
The app work perfectly
but the error is that appear is annoying
The type 'EventToCommandBehavior' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
also if you create a Init method in your vm, intelisense dont work
### Expected Behavior
VS dosent output any errors
### Steps To Reproduce
Create a project
create a globbal xmlns file like mane
put a eventToCommand
### Link to public reproduction project repository
https://github.com/eduardoagr/TaskManagerApp
### Environment
```markdown
- .NET MAUI CommunityToolkit:
- OS:
- .NET MAUI:
```
### Anything else?
_No response_
Contributor guide
Research direction
Start with the linked TaskManagerApp reproduction and its global xmlns file, then reproduce the EventToCommandBehavior error and missing IntelliSense for a ViewModel Init method. Compare the behavior with and without the global xmlns definitions; done means the app still builds and Visual Studio reports no false errors or missing IntelliSense.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- developer-experience, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100