Skip to content

[Proposal] Xmlns Definition #245

Closed
@bijington

Description

@bijington

Add Xmlns Definition

  • Proposed
  • Prototype
  • Implementation
    • iOS Support
    • Android Support
    • macOS Support
    • Windows Support
  • Unit Tests: (Not Required)
  • Sample
  • Documentation

Link to Discussion

#144

Summary

This proposal will result in reducing the number of xmlns declarations required in XAML files when using different parts of the toolkit. It would result in only needing to use a single declaration e.g.

xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/tookit"

Motivation

To reduce the number of xmlns declarations required in XAML files.

Detailed Design

More implementation detail than design but we should just require adding this for each part of the namespace:

[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/2022/maui/tookit", "CommunityToolkit.Maui.Behaviors")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/2022/maui/tookit", "CommunityToolkit.Maui.Converters")]
// ...

Usage Syntax

XAML Usage

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:toolkit="http://schemas.microsoft.com/dotnet/2021/maui/tookit"
             x:Class="MauiApp2.MainPage">
</ContentPage>

Drawbacks

There has been a discussion around whether this could introduce the linking issue that we saw in XCT (xamarin/XamarinCommunityToolkit#1311) however it is believed that this should not be an issue in the Maui Community Toolkit given we will actually have to call code that will prevent the linker from removing it.

Alternatives

Do nothing?

Unresolved Questions

N/A

Metadata

Metadata

Assignees

Labels

approvedThis Proposal has been approved and is ready to be added to the ToolkitchampionA member of the .NET MAUI Toolkit core team has chosen to champion this featuredocumentation approvedproposalA fully fleshed out proposal describing a new feature in syntactic and semantic detail

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions