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

Markup compiled XAML 2009 #58

Open
Zhentar opened this issue Dec 4, 2018 · 11 comments
Open

Markup compiled XAML 2009 #58

Zhentar opened this issue Dec 4, 2018 · 11 comments
Labels
Enhancement Requested Product code improvement that does NOT require public API changes/additions
Milestone

Comments

@Zhentar
Copy link

Zhentar commented Dec 4, 2018

XAML 2009 has been out for a few years now, and includes some features that would be quite nice to use with WPF in markup compiled XAML. What currently blocks XAML 2009 support? Where could community contributions help to move it forward?

@dotMorten
Copy link
Contributor

Related issue for one of these items: #45

@rrelyea
Copy link

rrelyea commented Dec 4, 2018

XamlReader.Load code paths in WPF support most of those features.

If I recall correctly, the markup compiler (in PresentationBuildTasks.dll) and designer support (VS Xaml Tools) would be the major blockers.
After we replumbed WPF in .NET 4.0 to use System.Xaml, we weren't able to justify spending our smaller resources on migrating the WPF MarkupCompiler to use System.Xaml.
I'm sure there will be other issues also...perhaps BAML format and reader/writer needs extending for some of this work?

@rladuca rladuca added the Enhancement Requested Product code improvement that does NOT require public API changes/additions label Dec 4, 2018
@rladuca rladuca added this to the Future milestone Dec 4, 2018
@dotMorten
Copy link
Contributor

we weren't able to justify spending our smaller resources on migrating the WPF MarkupCompiler to use System.Xaml.

Perhaps if we can get some guidelines how to do that, the community could provide those resources?

@airbreather
Copy link

airbreather commented Dec 4, 2018

I'm sure there will be other issues also

In case it helps, here's a behavior difference we've found between System.Windows.Markup in WPF and System.Xaml... it's a real edge case, so I figured it may help to bring it up here (if not, ignore me).

Our WPF app predates System.Xaml, and we've been using WPF's XamlReader / XamlWriter for serializing / deserializing our own objects for a while now.

One interesting "issue" we had when we tried moving that stuff to use System.Xaml: turns out that using WPF's XamlReader / XamlWriter, we can serialize / deserialize an instance of a type that doesn't have a public parameterless constructor, when the type has a [TypeConverter] attribute applied (but System.Xaml cannot save / load instances of such types).

Here's a complete repro to show the details of what I'm talking about (just a .csproj and a .cs file, under 100 lines between the two): https://gist.github.com/airbreather/1ca3ef7698b3539ac3cd1170144a6561


Super late edit: having learned much more about this in the past few years since I wrote that comment, I think this might just be a feature of the WPF XAML schema context helping us out, not anything intrinsically missing from System.Xaml itself. Probably just continue ignoring this comment 😬.

@usernamedd
Copy link

can someone explain Markup Complied XAML? the diff from normal xaml?

@Zhentar
Copy link
Author

Zhentar commented Apr 9, 2020

"normal xaml" as in a .xaml file in a WPF project (usually paired with a .xaml.cs file) is Markup Compiled XAML. Currently, only XAML 2006 (i.e. the original version) is supported. XAML 2009 adds a few features that would be nice to have available.

@DaveInCaz
Copy link

How come certain XAML2009 features do actually seem to work in markup compiled XAML? I know the documentation states this is not the case, but for instance I have had success using x:Reference within a xaml/xaml.cs usercontrol.

@yariker
Copy link

yariker commented Sep 16, 2021

People have been waiting for this feature for years. I remember reading about XAML2009 in WPF Unleashed by Adam Nathan as this new hot thing that's coming soon to WPF, but it never happened. Heck, I even asked about it on the recent .NET Conf: Focus on Windows, and @coolcsh said he didn’t know what I’m talking about 😁 (kudos to his team anyway).

It would be so nice to finally have this feature in .NET 6.0, and use x:Int32 without importing mscorlib, x:Arguments to instantiate object with non-default constructors, x:TypeArguments for generic types, x:FactoryMethod for things such as Guid.NewGuid, etc.

@DanJBower
Copy link

2009 was a pretty long time ago now. It would be awesome to see these features added as it would make certain things in WPF a lot easier 🙂

@LevYas
Copy link

LevYas commented Jan 3, 2024

This is still very much needed for those who still write desktop apps on WPF. I need it mainly for x:TypeArguments

@Metadorius
Copy link

Metadorius commented Sep 26, 2024

It is beyond me how basically the most mature and developed C# UI solution can't adopt XAML 2009 which allows generics, an important language feature, for 15 years already...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Requested Product code improvement that does NOT require public API changes/additions
Projects
None yet
Development

No branches or pull requests