Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Xmlns Definition #245

Closed
10 tasks done
bijington opened this issue Jan 13, 2022 · 10 comments · Fixed by #247
Closed
10 tasks done

[Proposal] Xmlns Definition #245

bijington opened this issue Jan 13, 2022 · 10 comments · Fixed by #247
Assignees
Labels
approved This Proposal has been approved and is ready to be added to the Toolkit champion A member of the .NET MAUI Toolkit core team has chosen to champion this feature documentation approved proposal A fully fleshed out proposal describing a new feature in syntactic and semantic detail
Milestone

Comments

@bijington
Copy link
Contributor

bijington commented Jan 13, 2022

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

@bijington bijington added new proposal A fully fleshed out proposal describing a new feature in syntactic and semantic detail labels Jan 13, 2022
@ghost ghost added this to Proposal Submitted in New Feature Proposals Jan 13, 2022
@bijington
Copy link
Contributor Author

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)

@bijington bijington moved this from Proposal Submitted to Proposal Approved in New Feature Proposals Jan 14, 2022
@ghost ghost added approved This Proposal has been approved and is ready to be added to the Toolkit help wanted This proposal has been approved and is ready to be implemented and removed new labels Jan 14, 2022
@bijington bijington added champion A member of the .NET MAUI Toolkit core team has chosen to champion this feature and removed help wanted This proposal has been approved and is ready to be implemented labels Jan 14, 2022
@bijington bijington self-assigned this Jan 14, 2022
@bijington bijington mentioned this issue Jan 14, 2022
6 tasks
@brminnick brminnick reopened this Jan 14, 2022
@brminnick brminnick moved this from Proposal Approved to Documentation Approved in New Feature Proposals Jan 14, 2022
@brminnick brminnick moved this from Documentation Approved to Pull Request Approved (Pending Documentation) in New Feature Proposals Jan 14, 2022
@egvijayanand
Copy link

Hello folks,

Having a suggestion on this one, the xmlns prefix can be made smaller because they need to be typed every time to refer to any of the types such as <toolkit:BadgeView>:

  • mct - Sounds similar to xct and corresponds to Maui CommunityToolkit
  • t - Similar to that x XAML xmlns prefix

Saves a lot of keystrokes and precious time.

Another one is a typo error in the current xmlns value. Note that it ends with tookit and not toolkit, the letter l is missing.

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

Notify to @brminnick @bijington

@bijington
Copy link
Contributor Author

@egvijayanand Thank you for this. I can't believe we missed the typo I will get that fixed shortly.

For the first point about the prefix this is entirely up to you as a consumer you can call it whatever you like e.g.

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

@egvijayanand
Copy link

Hi @bijington,

I do agree that preference on prefixes' is left to the user.

But I hope there'll be a default prefix value (defined with [XmlnsPrefix]) with which it'll ship, request to consider using a shorter prefix as most of the time we as end-users accept the default value and focus on the core logic at hand.

Regards,
Vijay Anand E G

@bijington
Copy link
Contributor Author

@egvijayanand thanks for this. I have a fix for the typo over at this PR #263 along with an initial discussion on what the prefix should be :)

@bijington
Copy link
Contributor Author

bijington commented Mar 7, 2022

We have recently discovered that due to marketing and legal reasons we need to be promoting toolkit rather than mct so therefore we will need to revert the change to provide the alias that was introduced in #264

The discovery came about in this PR which may absorb the change back:
#308

@bijington
Copy link
Contributor Author

Docs completed at: https://github.com/MicrosoftDocs/CommunityToolkit/blob/main/docs/maui/get-started.md

@bijington bijington moved this from Pull Request Approved (Pending Documentation) to Completed in New Feature Proposals Mar 15, 2022
@ghost ghost closed this as completed Mar 15, 2022
@brminnick brminnick added this to the v1.0.0 milestone Apr 15, 2022
@ghost
Copy link

ghost commented Apr 15, 2022

Reopening Proposal.

Only Proposals moved to the Closed Project Column and Completed Project Column can be closed.

@ghost ghost reopened this Apr 15, 2022
@pictos pictos closed this as completed Apr 15, 2022
@ghost ghost reopened this Apr 15, 2022
@ghost
Copy link

ghost commented Apr 15, 2022

Reopening Proposal.

Only Proposals moved to the Closed Project Column and Completed Project Column can be closed.

@pictos pictos moved this from Completed to Proposal Submitted in New Feature Proposals Apr 15, 2022
@pictos pictos moved this from Proposal Submitted to Closed in New Feature Proposals Apr 15, 2022
@pictos pictos closed this as completed Apr 15, 2022
@ghost ghost closed this as completed Apr 15, 2022
@ghost ghost reopened this Apr 15, 2022
@ghost
Copy link

ghost commented Apr 15, 2022

Reopening Proposal.

Only Proposals moved to the Closed Project Column and Completed Project Column can be closed.

@brminnick brminnick moved this from Closed to Completed in New Feature Proposals Apr 15, 2022
@ghost ghost closed this as completed Apr 15, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved This Proposal has been approved and is ready to be added to the Toolkit champion A member of the .NET MAUI Toolkit core team has chosen to champion this feature documentation approved proposal A fully fleshed out proposal describing a new feature in syntactic and semantic detail
Projects
Development

Successfully merging a pull request may close this issue.

4 participants