question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] Xmlns Definition

See original GitHub issue

Add Xmlns Definition

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

Link to Discussion

https://github.com/CommunityToolkit/Maui/discussions/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 (https://github.com/xamarin/XamarinCommunityToolkit/issues/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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

6reactions
bijingtoncommented, Jan 13, 2022

Given we now have our docs repository setup this change will drastically simplify the writing of the docs. I think this alone also then shows how it would simplify writing XAML in apps 😃

Please vote:

  • 👍 for
  • 👎 against (with reason in case we are missing something)
Read more comments on GitHub >

github_iconTop Results From Across the Web

XML Namespace Proposal
There are no simple, standardized means to express a document type which uses names from several namespaces. This paper proposes a conceptual model...
Read more >
ChangeProposals/html:xmlns - HTML WG Wiki
This change proposal in addition introduces underscore namespace prefixes as a way for authors to declare XML namespaces. This change proposal does not ......
Read more >
Add Xmlns Definition · Issue #432 · rotorgames/Rg.Plugins. ...
Description Add a XmlnsDefinition attribute to bring in all relevant namespaces in a single easy to use format, instead of having to bring ......
Read more >
XMLNS : a way to set them once for all?
xmlns are a document level thing needed by the compiler, they are like using statements which you will also have to place in...
Read more >
A Proposal for Namespaces in XML
The proposal which follows has two components: an explicit, prolix syntax based on marked sections, and an element-centred short form. 2. New Syntax...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found