Search code examples
wpfxamluwpwindows-community-toolkitxaml-islands

Host a standard UWP control in a WPF app using XAML Islands


I have used the following example to host a standard UWP control in a WPF app using XAML Islands: https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands

But if I get to the point:

  1. In your WPF project, right-click the Dependencies node and add a reference to your UWP app project.

I get the following error:

Unable to add a reference to project…

Why isn't this working?


Solution

  • In your WPF project, right-click the Dependencies node and add a reference to your UWP app project.

    I'm afraid you could not add the UWP project to WPF App (.NET Framework). Because it does not contain Dependencies option.

    I tried create .NET Core WPF App(if you want to create a WPF App (.NET Core) project, you must first install the latest version of the .NET Core 3 SDK.) app and add UWP reference, and it's success. And Please make sure the target version and minimum version are both set to Windows 10, version 1903 or later.