Feature: alternative "using:" syntax to include namespace to XAML file
See original GitHub issueCurrently Avalonia supports WPF’style namespaces in XAML files, using clr-namespace with assembly. With that we need to provide long path to assemblies, if namespace isn’t contained in current one. UWP and XF supports another syntax, using “using:” keyword (for UWP it is only one available syntax). With this we don’t need to provide assembly, instead it will internally search for namespace in referenced projects and packages.
Proposal syntax:
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="using:System"
xmlns:controls="using:MyNamespaceInAnotherAssembly">
<Style Selector="controls|MyControl" />
</Window>
Xamarin Forms docs: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/namespaces#declaring-namespaces-for-types
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:10 (9 by maintainers)
Top Results From Across the Web
XAML Custom Namespace Schemas in Xamarin.Forms
An alternative approach is to define a custom namespace schema, such as http://mycompany.com/schemas/controls , that maps to one or more CLR ...
Read more >What happens when I import a namespace in XAML?
I have been wondering whether it would make more sense to put all of my controls into a more centralised namespace that I...
Read more >Using namespaces: Aliasing/Importing - Manual
Here is an example showing all 5 kinds of importing: Example #1 importing/aliasing with the use operator. <?php namespace foo; use My\Full\Classname as ......
Read more >Namespace - Wikipedia
In computing, a namespace is a set of signs (names) that are used to identify and refer to objects of various kinds. A...
Read more >Google C++ Style Guide
These rules exist to keep the code base manageable while still allowing coders to use C++ language features productively. Style, also known as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I added this to the WinUI prototype Xaml compiler based on XamlX, and this is pretty easy to add to the XamlX library.
Just because UWP doesn’t care about anything except C#. To use it properly (release mode = .net native) you have to edit gatekeeper config manually. At least for F# for sure. I doubt the situation is better for VB (which is literally dead for Microsoft) and C++/CLI.
Also not all developers who use Avalonia have previous UWP/XF/WPF background, besides there are features that specific only to Avalonia already (at least I think so).
From the start Avalonia has better F# support than the rest of .net - ui - frameworks. Providing one alternative synonym for keyword doesn’t sound like a big deal but it allows write more idiomatic code.