Closed Ajith-GS closed 1 month ago
There's no "WinUI3 XAML Island" yet. I believe this issue stems from that.
I also believe @darranrowe and @castorix can help you.
There's no "WinUI3 XAML Island" yet. I believe this issue stems from that.
I also believe @DarranRowe and @castorix can help you.
Hi, Starting with Windows App SDK Version 1.4, XAML Islands technology is available. https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/release-notes-archive/stable-channel-1.4#xaml-islands-no-longer-experimental
WinUI 3 XAML hosting (WinUI 3 user control) has been performed by referring to the official Windows App SDK samples available in the following repo. https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/Islands
Support for changing the HWND parent chain is out of scope for the product at this time. This includes cross-proc OLE Document integration with MFC. (Supporting changing the HWND parent chain around is actually a lot of work because there's a lot of corner cases. We explicitly added code to detect when this was happening to help developers realize when they were hitting this unsupported scenario.)
Instead of changing the HWND parent chain for a given DesktopWindowXamlSource, it's recommended to create a new DesktopWindowXamlSource control whenever the HWND parent changes, and then move the UIElements from the old DWXS to the new DWXS control instead.
I will resolve this issue as by design.
Describe the bug
We have been using an Active Document server application that is embedded in an Active Document container application by creating an OLE object for the server application. A sample application with the same implementation is attached. We have several such kinds of server applications embedded in the same container application. As a part of the modernization, WinUI3 XAML hosting is performed, and its success full if we invoke the server application alone(standalone invoking). However if we invoke the container application, during the in-place activation of the server object using the DoVerb method, following error is occurred and the initialized DesktopWindowXamlSource is closing unexpectedly.
Msg:[HWND 0000000001031156 changed parent from 00000000011F0F7C to 0000000000F71198. Unsupported scenario.] MyActiveServer.exe: WinRT originate error - 0x8007139F : 'WindowParentChain invalid state.'.
From my understanding, the Windows App SDK 1.4 or later does not support the HWND parent chain changing while DesktopWindowXamlSource is in use, as mentioned in the GitHub issue #8900 .
But Active Document Containment is a generally using technology to embed an active document server object within another active document container as mentioned in the MSDN( https://learn.microsoft.com/en-us/cpp/mfc/active-document-containment?view=msvc-170). Why Windows App SDK is unable to support this kind of scenario?
Is there a workaround available currently to address the issue mentioned above? I would be very grateful for any assistance.
Steps to reproduce the bug
CompoundDocTest.zip contains the following projects to simulate the above scenario.
Expected behavior
XAML control from WinUI3xTest_DLL should be hosted on CMyActiveServerView successfully.
Screenshots
Standalone execution of MyActiveServer.exe.
Execution of MyActiveContainer.exe.
NuGet package version
Windows App SDK 1.5.5: 1.5.240627000
Packaging type
Unpackaged
Windows version
Windows 10 version 22H2 (19045, 2022 Update)
IDE
Visual Studio 2022
Additional context
No response