question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Beginners Question: Are UWP, WPF and Xamarin.Forms not the same?

See original GitHub issue

I’m currently learning UWP and Xamarin.Forms, beginning with UWP.

Until a few moments ago I wasn’t aware that UWP, Xamarin.Forms and WPF apparently don’t have much in common, except they rely on XML as their markup language. I believed that XAML was sort of a “standard” spanning all the products. Yet, a few minutes ago I received an answer on GitHub and an answer in the Xamarin.Forms forum telling me different.

😟😥 Sigh … To me that looks much like tripling the effort of learning UWP, Xamarin.Forms and WPF altogether if they all go into different directions.

sigh

Do you know, is there perhaps a strategic effort on the way keeping all three flavors in sync?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

7reactions
Felix-Devcommented, Jul 27, 2020

@SetTrend WinUI (UWP) XAML and WPF XAML flavors will probably never be fully aligned. What we could see is that new features like simplified Grid Column and Row definitions will be added to both WinUI and WPF in the future (and MAUI perhaps as well - the successor to Xamarin.Forms).

WinUI Desktop will also bring over UWP XAML to Win32 apps without devs having to explicitly use the current XAML Island technology, so for new UWP or Win32 apps, you would ideally use the same XAML flavor in the future once WinUI 3 has been released. With WinUI being the leading native UI platform on Windows (in terms of investments), in the future there should be less and less reasons to pick WPF over WinUI for new Win32 apps. The WinUI team is also working on bringing over missing WPF features to WinUI to help close the gap between these two products.

UWP XAML and WPF XAML do have quite a few similarities (more than with Xamarin.Forms’ XAML flavor) but they also have some essential differences: @robloo Created a detailed overview about differences between them and what the alternatives available are here.

As for Xamarin.Forms: That product is being supeceded by MAUI and the community has been passionately asking for MAUI to align itself with the UWP (WinUI) XAML flavor where it makes sense. If, and to what extend the Xamarin.Forms/MAUI team will act upon that request is unknown as of yet to my understanding. An issue listing specific XAML alignment proposals can be found here.

6reactions
robloocommented, Jul 28, 2020

It pretty much looks like there actually is no such thing like “XAML” (aka. “XAML language”). A construct like “XAML” doesn’t exist. It’s just three distinct UI frameworks, non-related whatsover, incidentally each using plain XML for describing their views.

So, if I got you correct, XAML is just a marketing jib but not a real semantic construct at all. It could as well just have been called “XML”, but that wouldn’t have perceived by the audience as sort of an invention.

XAML very much exists and is more-or-less standardized. It is simply a language, based on XML. However, the object model that language describes is very different and separate. So XAML is the same, object model is different.

So, if one of the three UI frameworks decided to rename a <Button> element into <Burton> element or invent a new strategy of navigating, that’d be fine because “XAML” doesn’t impose any constraints on anything.

Yes! As you point out the XAML syntax is the same with <Button> and <Burton> but they are creating two entirely different objects – one Button and one Burton.

The evolution of the UI frameworks, and their object models, is below. There is no ‘base’ framework as there are historically three completely separate implementations. Only the Microsoft branch has a somewhat logical evolution though.

  • Xamarin : Xamarin.Foms -> MAUI
  • Microsoft : WPF -> Silverlight -> UWP -> WinUI

(Note Silverlight was a rewrite in C++ instead of managed C# code and lost a lot of features in the original WPF. Overall we have still not gotten to the point where UWP is as powerful, stable and feature-complete as WPF. However, WinUI is attempting to fix those wrongs now and later versions of UWP were getting close while providing better in-box controls.)

Xamarin was a separate company before being purchased by Microsoft. They purposely made changes to the XAML/object model so they wouldn’t get sued by Microsoft and they also thought they could do things better. I suggest reading though https://github.com/dotnet/maui/issues/43 as @Felix-Dev suggested in some detail to know the full history. The Maui object model is so much more inferior compared to WPF/UWP its almost not worth discussing though. It should not exist in my opinion and making it part of .net where WPF already exists - with a completely different design - is a big strategic mistake. It creates a big confusion for new developers like yourself and a major frustration for even experienced developers who have existing code that depends on existing features (even basic features like putting an symbol inside a button).

If that’s really the intention: “one .NET to rule them all”, then I wonder why we don’t drop all other UI frameworks (incl. UWP and WPF) and just use MAUI for them all.

This is the biggest frustration with Microsoft right now. Microsoft is a big company and there are lots of independent teams. High-level leadership in this space seems to lack a vision as well. We are now seeing a result of this. WinUI is on the right track. Maui… well… a lot of us don’t see how its a good idea.

So explain how MAUI is now the cross-platform standard instead of historical Microsoft tech? (rhetorical) It’s a bad decision on Microsoft’s part for a number of reasons including the basic architecture. Maui translates to native controls on each platform instead of rendering on it’s own surface or rendering pixel-perfectly on top of platform primitive controls. This means you will never get complex UI to work correctly on all platforms without writing custom renderers. It requires constant tweaking and ignores the modern convention to create consistent UI on all platforms.

Microsoft’s fragmenting of the ecosystem and inability to standardize XAML/object model between WinUI and MAUI teams is concerning. We tried to warn them of it but the Xamarin team is quite smug about such things and feels they know best. Where they are now is also a product of past decisions and the desire to maintain compatibility. However, in practices it represents an inability to understand developers want a unified system that runs everywhere but is consistent with what we already know – and maintains full power. MAUI is advertised as being such a system. However, its architecture is so bad I don’t think it will ever get there.

It will always frustrate me Microsoft pulled in Xamarin.Forms into .net itself and claimed it as the future, single cross-platform solution Maui. Instead I would encourage the use of Uno Platfom + WinUI for apps that truly run everywhere (including the web browser). It is using the latest XAML from the true Microsoft branch and is architectured in a way it maintains almost full power.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WPF vs. Xamarin.Forms: Similarities & Differences
This document compares and contrasts WPF to Xamarin.Forms. It discusses control templates, XAML, binding infrastructure, data templates, ...
Read more >
WinForms vs UWP vs WPF ? : r/dotnet
WPF is not cross-platform, only runs on windows desktop, but is supported in previous windows versions unlike WinUI that's why many companies ...
Read more >
Comparison of UI controls between Xamarin.Forms, UWP ...
I'm looking for a mapping of controls with similar functions (example, UWP/WPF:stackpanel vs. Xamarin:stacklayout), and that describes the major ...
Read more >
WinForms vs WPF vs UWP: Expectations vs. Reality
The three solutions are WinForms, WPF, and UWP. There might be a misconception that UWP is a framework like WinForms and WPF but...
Read more >
Should I learn UWP or Xamarin?
It's hard to answer that question if I don't know your goal. What do you want to achieve? Do you have a job...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found