Does .NET MAUI support WPF?

Devi Prasad 91 Reputation points
2022-05-16T09:58:08.377+00:00

As we know we can create UWP applications in MAUI, Please let me know can we create WPF applications In .net MAUI, If there is any possibility please let us know what is the approach for that.

[Goal clarification edited in from comment --RC]

We have developed an application which is Kvaser(Cable) hardware support application which supports only WPF applications. We have done this in Xamarin Forms by adding Windows Application project and referencing UWP application to Windows Application and we are communicating using App Service Connection the solutions we have done is working fine in Xamarin Forms. Now we are planning to migrate Xamarin Forms to .NET MAUI, Is there any work around to achieve the same solution in MAUI.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,667 questions
Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
722 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,842 questions
{count} votes

Accepted answer
  1. Rob Caplan - MSFT 5,412 Reputation points Microsoft Employee
    2022-05-18T21:54:18.083+00:00

    We have developed an application which is Kvaser(Cable) hardware support application which supports only WPF applications. We have done this in Xamarin Forms by adding Windows Application project and referencing UWP application to Windows Application and we are communicating using App Service Connection the solutions we have done is working fine in Xamarin Forms. Now we are planning to migrate Xamarin Forms to .NET MAUI, Is there any work around to achieve the same solution in MAUI.

    You should be able to achieve the same scenario in a MAUI app. MAUI (and Xamarin) give the app access to the underlying native platform, and what you're doing is primarily at that level. That you have MAUI (or Xamarin Forms) on top is largely irrelevant, and you will have more capabilities in the .Net 6 + WinUI platform than in UWP.

    Key points:

    • The UI layer (Xamarin Forms vs MAUI) is not related to connecting to hardware; the limitations (or lack thereof) are on the underlying platform.
    • Your Xamarin Forms (Windows) app is a UWP app, which runs in a sandbox with restricted system access
    • MAUI (Windows) apps use .Net 6 + WinUI 3 (Windows App SDK fka Reunion), which is not sandboxed.

    A few options:

    • From a quick glance through the WindowsAppSDK repo, I think you should be able to continue using your App Service Connection solution in the WinUI solution. The limiting factor is the app ID, which you'll have with a WinUI app packaged in an MSIX. This should work essentially the same as in your existing UWP app.
    • If your dependency is just on the Kvaser SDK and not the WPF UI itself then you should be able to call it directly from your MAUI app. MAUI on Windows runs the same .Net 6 that modern WPF apps do and doesn't have the UWP sandbox limitations that would block it from talking to the Kvaser hardware. From a quick look at Kvaser's site, their SDK supports .Net Standard 2.0 and should run fine in .Net 6.
    • You can use lighter weight IPC such as named pipes to communicate between your WPF app and your MAUI app.
    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Michael Taylor 47,711 Reputation points
    2022-05-16T14:32:12.953+00:00

    No. MAUI and WPF are different technologies. MAUI is a cross-platform framework for building UX based upon Xamarin Forms. While it uses XAML it is not the WPF runtime and is not compatible. WPF is Windows only and was actually deprecated back in the UWP days although many people still use it. Here's a good article on the available desktop frameworks.

    MAUI is moving at a pretty fast pace right now and I think it is getting close to RTM, if not already there. In the interim you have choices in the desktop framework to use. If you want well-supported, tested support then stick with WPF or Winforms for now. But that is Windows only. If you need to support other platforms then MAUI, even if not released yet, is probably the way to go. I wouldn't bother with Xamarin Forms at this point.

    Unfortunately I don't believe there is any formal support for migrating from WPF to MAUI. While they use XAML they are quite different. Here's a recent post with some migration suggestions.