question

DeviPrasad-9634 avatar image
0 Votes"
DeviPrasad-9634 asked DeviPrasad-9634 commented

Does .NET MAUI support WPF?

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-wpfdotnet-mauiwindows-app-sdk
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Minor note: MAUI does not create UWP applications. The MAUI Windows target is WinUI 3.
See https://docs.microsoft.com/en-us/dotnet/maui/supported-platforms

0 Votes 0 ·

Hi @RobCaplan

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.

0 Votes 0 ·
RobCaplan avatar image
1 Vote"
RobCaplan answered DeviPrasad-9634 commented

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.




· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @RobCaplan thanks for your valuable information

We have tried the below solution
"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."

But while adding Kvaser SDK it is showing warning and we are not able to run the project, could you please help me on any other solutions and could you please provide where can find Kvaser supports .Net 6.0 related info.

0 Votes 0 ·
RobCaplan avatar image RobCaplan DeviPrasad-9634 ·

I can't provide help on the Kvaser SDK specifically. You will need to talk to them for specific help on their SDK. Assuming it supports .Net Standard 2 (which they say it does, if you're using the SDK described in https://www.kvaser.com/developer-blog/using-canlib-visual-studio-2019-c-net-standard-2-0/ )then it should run in .Net 6, as .Net 6 implements .Net Standard 2. If it has other requirements (e.g. if it requires WPF) then you'll need to check those as well.

0 Votes 0 ·

@RobCaplan Thank you so much we have achieve the above by referencing the latest DLL

0 Votes 0 ·
cooldadtx avatar image
0 Votes"
cooldadtx answered RobCaplan commented

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.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @cooldadtx

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.

0 Votes 0 ·
cooldadtx avatar image cooldadtx DeviPrasad-9634 ·

AFAIK this is not supported in MAUI. See here but perhaps you are better served by posting in their Github repo so you can get a response from the folks who are actually building it.

0 Votes 0 ·

Building a WPF app is not supported in MAUI - as noted, they are two different UI implementations which both run on .Net 6. WPF is Windows specific, while MAUI is cross-platform.

The clarified problem itself is not directly related to MAUI (or WPF), but is rather about the underlying Windows platform (.Net 6 + WinUI 3) MAUI sits on top of. There are many useful platform features that MAUI doesn't directly support but which are usable in a MAUI app via platform specific code.

0 Votes 0 ·