Use XamlHostingKit for UWP hosting - #31
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70aecda89e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🟡 Changes recommended
Critical resource and flyout-readiness issues remain unresolved, along with moderate theme and focus regressions.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR replaces manual UWP XAML-island hosting and the Win32 message loop with XamlHostingKit, while refactoring the tray sample, dependencies, and documentation.
Changes:
- Adds XamlHostingKit-based UWP hosting and window-thread APIs.
- Updates flyout readiness, focus, activation, theme, and cleanup handling.
- Refactors the UWP tray-host sample and documentation.
File summaries
| File | Summary |
|---|---|
src/DesktopFlyouts.Uwp/DesktopFlyouts.Uwp.csproj |
Adds hosting and compatible projection dependencies. |
src/DesktopFlyouts.Shared/XamlIslandHostWindow.X11.cs |
Adds initialization state. |
src/DesktopFlyouts.Shared/XamlIslandHostWindow.Uwp.cs |
Implements XamlHostingKit hosting; async readiness and focus behavior require changes. |
src/DesktopFlyouts.Shared/XamlIslandHostWindow.cs |
Restricts the legacy host to WASDK and tracks initialization. |
src/DesktopFlyouts.Shared/XamlIslandApplication.cs |
Adds UWP startup and window creation APIs. |
src/DesktopFlyouts.Shared/DesktopMenuFlyout.cs |
Adds readiness checks; the target must also be attached before ShowAt. |
src/DesktopFlyouts.Shared/DesktopFlyouts.Shared.projitems |
Includes the UWP host implementation. |
src/DesktopFlyouts.Shared/DesktopFlyout.cs |
Uses host readiness checks. |
samples/DesktopFlyouts.Uwp.Sample.TrayHost/Program.cs |
Starts the tray host through XamlHostingKit. |
samples/DesktopFlyouts.Uwp.Sample.TrayHost/MainDesktopMenuFlyout.xaml.cs |
Removes obsolete code-behind. |
samples/DesktopFlyouts.Uwp.Sample.TrayHost/MainDesktopMenuFlyout.xaml |
Removes declarative menu markup. |
samples/DesktopFlyouts.Uwp.Sample.TrayHost/MainDesktopFlyout.xaml.cs |
Removes obsolete code-behind. |
samples/DesktopFlyouts.Uwp.Sample.TrayHost/MainDesktopFlyout.xaml |
Removes declarative flyout markup. |
samples/DesktopFlyouts.Uwp.Sample.TrayHost/DesktopFlyouts.Uwp.Sample.TrayHost.csproj |
Updates UWP build configuration. |
samples/DesktopFlyouts.Uwp.Sample.TrayHost/App.xaml.cs |
Builds and dispatches flyouts; theme-aware background handling requires changes. |
samples/DesktopFlyouts.Uwp.Sample.TrayHost/App.xaml |
Simplifies resources; required XAML control resources must be retained or replaced. |
README.md |
Documents UWP startup. |
docs/getting-started.md |
Adds UWP hosting instructions. |
docs/focus-and-activation.md |
Updates message-loop guidance. |
Directory.Packages.props |
Updates package versions. |
.nuget/README.md |
Documents packaged UWP usage. |
Review details
- Files reviewed: 21/21 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Fixes
DesktopWindowXamlSourcehost and manual Win32 message loop with XamlHostingKit.XamlIslandApplication.StartandXamlIslandApplication.CreateWindowfor main and additional System XAML threads.DesktopFlyoutandDesktopMenuFlyout.CoreDispatchersynchronization context on every hosted XAML thread so asynchronous show and hide work resumes on the correct thread.Show()calls made during asynchronous content attachment and replays them after the initial XamlHostingKit activation cycle.XamlSourceFocusNavigationReasonvalues to descendant and directional focus navigation.CustomizableFlyout.xamlandMainDesktopMenuFlyout.xaml, matching the WASDK sample structure.DesktopFlyouts.Uwp.Sample.App.tif-secondaryapp:protocol activation demo.Steps to validate
msbuild samples/DesktopFlyouts.Uwp.Sample.App/DesktopFlyouts.Uwp.Sample.App.csproj /t:Restore /p:Platform=x64.dotnet msbuild /restore:false src/DesktopFlyouts.Uno/DesktopFlyouts.Uno.csproj /p:Configuration=Debug /p:Platform=x64 /p:AppxBundle=Never.dotnet msbuild /restore:false samples/DesktopFlyouts.Wasdk.Sample.App/DesktopFlyouts.Wasdk.Sample.App.csproj /p:Configuration=Debug /p:Platform=x64 /p:AppxBundle=Never.dotnet msbuild /restore:false src/DesktopFlyouts.Uwp/DesktopFlyouts.Uwp.csproj /p:Configuration=Debug /p:Platform=x64 /p:AppxBundle=Never.msbuild samples/DesktopFlyouts.Uwp.Sample.App/DesktopFlyouts.Uwp.Sample.App.csproj /p:Configuration=Debug /p:Platform=x64 /p:GenerateAppxPackageOnBuild=true /p:AppxPackageSigningEnabled=false /p:AppxBundle=Never /restore:false.shell:AppsFolder; do not run the packaged executable directly.DesktopFlyouts.Uwp.Sample.Appremains responsive and that the Windows Application event log contains no new DesktopFlyouts errors.shell:AppsFolderand confirm it is responsive with a non-zero window handle.git diff --checkand verify changed text files reportw/crlffromgit ls-files --eol.