Suggest to introduce a new attribute, like XamlAlias, so that long type names can be referenced with its Alias
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 296
Description
Description
Suggesting to introduce a new attribute, like XamlAlias, so that long view names can be referenced with its Alias.
For example, HorizontalStackLayout can be shortened to HStack and used within the XAML code.
The attributes need to be defined on the definition of intended types. This is similar to the ContentProperty attribute, where mentioning the default content node is optional like ContentPage.Content.
Though it is possible to sub-class the type with the shortened name and use it, the issue will be the style definitions needs to be allowed to extend for derived classes and that can have consequences if other real definitions are available within the project.
During Xaml compilation, the alias names are to be replaced with actual type names.
This will simplify things and improve productivity.
Public API Changes
public class XamlAliasAttribute : Attribute
{
public string AliasName { get; set; }
}
[XamlAlias("HStack")]
public class HorizontalStackLayout : StackBase
{
// ...
}
Intended Use-Case
Before:
<HorizontalStackLayout>
<!-- Content -->
</HorizontalStackLayout>
After:
<HStack>
<!-- Content -->
</HStack>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing ContentProperty attribute behavior and the XAML compilation path mentioned in the issue. Determine how aliases would be declared on types, resolved in XAML, and handled in style definitions; the work is done when the proposed HStack syntax resolves to HorizontalStackLayout without breaking existing type or style resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100