Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows GUI: WPF or WinRT (2015+)

I am trying to get an overview of the different technologies, to use when building GUI's in the Windows World.

For context, I am building a little 2d platform multiplayer game. (Just for learning purpose..)

My teacher says that he think that WPF is the right way to go, but it seems that he only compare it to Windows Forms.

My understading is, that here in 2015, Windows Forms is totally dead?

In this other stackover questions, they say WinRT+XAML is for Metro GUI building(Window 8 tiles thing!), and it seems that WPF is something used only for desktop in Window 7/8 and are close related to Silverlight..

How does Windows 8 Runtime (WinRT / Windows Store apps / Windows 10 Universal App) compare to Silverlight and WPF?

  • The desktop is where the old apps live (red. WFP).
  • The new class of applications, Metro applications, can be built in a number of ways, including by VB.NET, C# or C++. These three language options can use XAML for building the UI. The alternative is to use JavaScript/HTML5/CSS for the development of both the UI and application code.

My real question is: Isn't there ONE good way to build GUI's in the Window World?

And if not, which technologies should one use on Window 7, Window 8(Desktop and Metro), Window Phone, (And Windows 10!), and even x-box..

Is it to different technologies to be compared this way?

What do you think is the right thing to invest time in?

like image 301
Alf Nielsen Avatar asked Feb 18 '15 14:02

Alf Nielsen


People also ask

Is WPF still relevant 2021?

WPF is still one of the most used app frameworks in use on Windows (right behind WinForms).

Is UWP better than WPF?

How is a WinUI UWP App Better than WinForms and WPF? Well, in short - it gives a modern look and feel to the applications with the Fluent Design pattern, and it is built based on C++ so it performance optimized compared to WPF apps.

Is WPF being deprecated?

It was in 2006 that Windows Presentation Foundation (WPF) was released with . NET framework 3.0. Over the years it got improved and it is still now in the market in 2021.

Is WPF same as UWP?

WPF is another UI framework, and UWP uses many concepts that you find in WPF, like XAML, data binding, styles etc. That means that a WPF developer gets up to speed with UWP quite fast, and vice versa. But WPF is not a UI framework that C++ developers can use, for WPF you have to develop with .


1 Answers

There's a lot here, but here goes:

  • Is Windows Forms (Winforms) dead? No. Its still actively supported. That said, its a horrible technology to work in (at least once you know the magic of WPF)
  • If you want to build a nice-looking, well designed desktop (classic, not Metro) app, WPF is the answer in pure .NET terms. You can use WinRT APIs (such as their socket classes) but you can't run them on OSs before Windows 8. The UI is still WPF.
  • WinRT Apps are for the Windows 8 Store (they are also available in the Windows 10 Store). You can't use WPF here, or WinRT on the desktop, so where you deploy determines what you use. You are correct in your understanding of the languages/technologies available.
  • Windows Phone 8 (now deprecated) uses a modified runtime of WinRT (this has changed in Windows 10). For Win8/WP8, you can use "Universal" apps to share most of the code between a standard WinRT app and a windows phone app.
  • Windows 10 uses the Universal Windows Platform (UWP) which is based on WinRT. Code developed for Windows 10 can also be used on Xbox One, Windows 10 Mobile, and HoloLens. WPF is still for "standard" desktop apps.
  • Xbox is tricky. XNA has gone away, and Microsoft seems to be going away from community created content for the platform. That said, Unity3D can deploy to Xbox, and I believe standard DirectX (C++) development works for it. Universal Windows Platform apps can also be deployed on the Xbox One, and this seems to be Microsoft's strategy going forward.
  • As of 2021, WinUI 3 is a new UI framework that brings the UI framework of UWP to "desktop" apps. This technology will let you deploy to Windows 10 and 11. Existing XAML UWP apps can generally be easily ported to WinUI 3 by changing to the new namespace. If starting an application today, I would seriously consider going this route. It is part of the Windows App SDK.

As far as what to spend time on, that depends on what you are targeting :). Learning WPF/UWP + XAML will yield you a lot of benefits if you want to stay "current" in .NET GUI development, so thats what I would go for. WPF has the most features, so by starting there you just have to find workarounds for what is missing in UWP (or any other XAML based tech).

If you do that, make sure to learn the MVVM (Model-View-View Model) pattern. It works really well with the XAML based technologies, and allows you to share a lot of logic between your WPF and UWP applications. The same logic can also be used if you eventually develop Xamarin applications for iOS/Android, etc.

Note that for true game development, you'll want an actual game framework (like Unity3D or even XNA). You can do it in WPF, and that's a better choice than Winforms, but neither are really meant for games.

like image 124
BradleyDotNET Avatar answered Oct 24 '22 14:10

BradleyDotNET