Replies: 4 comments 3 replies
-
Unfortunately, Microsoft.UI.Xaml.Application or WindowsXamlManager is required since it works as a controller for Xaml. This means that without Xaml Islands, you have to have a fully functioning Application object. This includes the Xaml metadata provider. Also, with my experiments with Xaml Islands, "marshalled for a different thread" can also mean that a dispatcher queue doesn't exist for the UI thread. |
Beta Was this translation helpful? Give feedback.
-
I'm using 1.2.220727.1-experimental1. I was able to create an Application class. The required code is generated in App.g.i.cs for an App.xaml object, but is not called in a class library:
At this point if I were using WPF, I'd try to look at the https://referencesource.microsoft.com/ or github to try to understand what's happening, but unless I'm not finding it, WinUI3/AppSDK is even less "open source" than WPF was... only some of higher level components are open source, not things like Window or Application. This seems like a very basic interop scenario 😑 |
Beta Was this translation helpful? Give feedback.
-
The issue is that UWP Xaml/WinUI 3 and WPF try to completely control things. It is part of that making things simpler removes more advanced options things. |
Beta Was this translation helpful? Give feedback.
-
The Startup Main object can be customized in the WPF project settings, I think... I'm guessing the fact that a class library does not auto-generate a XamlTypeInfo.g.cs (see bottom of this page https://jaylee.org/archive/2012/03/08/xaml-integration-with-winrt-and-the-ixamlmetadataprovider-interface.html) when there is no corresponding XAML App project by which to generate it (just a WPF project), is also contributing to the fact that I can only get the most basic XAML working... Seems like a tool design issue. Will "experimental" XAML islands work solve it? (without a lot of manual work arounds)? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to simply do the following:
Have an unpackaged WPF app referencing WinUI3
(following this
https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/use-windows-app-sdk-in-existing-project
https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time
Create and show a WinUI3 window from WPF
A. I assume XAML islands (embedding inside a WPF window) for WinUI 3 is still being developed.
B. If XAML islands isn't available, can I simply create a new Microsoft.UI.Xaml.Window from a WPF System.Windows.Window? How do I do this with WinUI3 XAML in a class library (not application)? Am I missing initializing something? Whenever I create a window (or application) I get an error, "The application called an interface that was marshalled for a different thread." I've tried various things involving creating a DispatcherQueue, but it hasn't helped...
C. I assume there's no compiler magic trick to including WPF/.NET6/Microsoft.WindowsDesktop.App and Microsoft.WindowsAppSDK XAML windows in the same project. (When I tried that, compiling a WinUI3 XAML window tried to generate a .g.cs for a WPF window instead.)
Beta Was this translation helpful? Give feedback.
All reactions