Improve XAML by removing noise
See original GitHub issueIs your feature request related to a problem? Please describe.
I’m always frustrated when trying to explain XAML to a web developer.
Describe the solution you’d like
Remove all the unnecessary noise from XAML and make it friendlier to everyone.
Describe alternatives you’ve considered
None at the time.
Additional context
So, this is the XAML for an Avalonia Hello World:
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="MyApp.Window1"
Title="Window1">
Welcome to Avalonia!
</Window>
That’s a lot of noise to explain to somebody who has never used Avalonia nor WPF. It would be awesome if it was just:
<Window Title="Window1">
Welcome to Avalonia!
</Window>
Since none of the other stuff is really required.
xmlns
andxmlns:x
should really be implicit for every XAML file ever, since they’re pretty much required.xmlns:d
andxmlns:mc
are designer-specific concerns that don’t really belong into production source code. The designer / previewer could handle this implicitly.x:Class
has 2 pieces of information:- the namespace could be implicitly derived by the location of the XAML file relative to the root of the project (following C# namespacing convention). It could still be explicitly added manually to override the convention if required.
- the class name could be implicitly derived from the XAML file name.
Also: it would be awesome if custom and user controls in an assembly where implicitly mapped to the root namespace instead of having to define a custom XAML namespace for them.
Issue Analytics
- State:
- Created 3 months ago
- Reactions:9
- Comments:20 (10 by maintainers)
Top Results From Across the Web
I'm sometimes surprised how good looking c# .net xaml ...
I'm sometimes surprised how good looking c# .net xaml apps can be with minimal effort. Here's a small white noise app project I...
Read more >Best way to improve performance in WPF application
From here, run a copy of the application with an isolated database server (no other clients hitting it to reduce "noise") with the...
Read more >Optimize your XAML markup - UWP applications
Here are some things you can do to improve XAML markup parse and load time and memory efficiency for your app.
Read more >global (and implicit) using directives - but for XAML?
As part of my exploration into how XAML files could be made better, I've been looking at whether something similar could be done...
Read more >Remove Noise from Images in C# .NET (JPG, TIFF, PNG)
Remove noise vigorously with the FxBitonalVigorousDespeckle method of the GdPictureImaging object. This method cleans so vigorously that some data might be ...
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 FreeTop 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
Top GitHub Comments
I dont like #2502
It is not better than this proposal, 2502 is flutter or qml or other strange thing but not xaml
this proposal maintain xaml and only simplifies markup, improving developper experience.
I strongly disagree.
There is nothing “more difficult” in this:
compared to this:
Quite the contrary, all that useless noise makes me really want to quit XAML and learn HTML and React just to be able to write markup similar to the first example.
Again, there is absolutely no need to read any documentation to understand my first example. Quite the contrary, people need to read tons of documentation just to be able to understand a simple Hello World app with all that amount of useless noise and unnecessary complexity in the markup. Let alone anything more complex.
Sorry, WPF is legacy and MAUI is honestly unusable and full of bugs. I personally couldn’t care less about any of that.
Also, as mentioned above, my proposal includes an MSBuildFlag (let’s call it
<UseLegacyXaml>True</UseLegacyXaml>
if you want / need to use legacy XAML.This does not happen in practice, and if it does the compiler should fail to build that specific case, which is 0.00001% compared to the 99.9999% of times I do not have any conflict but still I’m forced to explicitly specify everything manually, which again leads to useless noise.
My proposal makes development substantially easier by avoiding unnecessary details such as namespaces that are totally not relevant when writing, nor maintaining code. This noise results in cognitive load, and cognitive load makes development substantially harder and more painful.
Yes. People are free to write legacy code with legacy idioms all they want. I personally want a way forward that doesn’t force me to write code like it was 2006.